If I remember well (I cannot check the code now, see test.txt file in my last mail), I am already using this method after SetGridCursor
···
----- Mensaje original -----
De: werner <wbruhin@free.fr>
Enviado: sábado, 25 de septiembre de 2010 11:15
Para: wxpython-users@googlegroups.com
Asunto: Re: [wxPython-users] Re: SetGridCursor not working?
On 25/09/2010 10:24, Dani Valverde wrote:
On 09/25/2010 01:08 AM, Robin Dunn wrote:
On 9/23/10 5:21 PM, Dani Valverde wrote:
On 09/24/2010 12:47 AM, Robin Dunn wrote:
On 9/23/10 3:15 PM, Dani Valverde wrote:
Hello!
Can anyone help, please? This is a very important feature for my
application ...
Thank you so much!Dani
On 09/22/2010 08:45 PM, acrocephalus wrote:
Hello!
I have a table with some rows and cells (code at the end), and
created
a function which searches for text inside the cells and returns the
row number where the text is (to simplify the example, only English
Name is working). Then, it should set the grid cursor focus to that
row (I want to use the wx.grid.Grid.SelectRows style when created
the
wx.Grid, but to reduce the number of variables I don't use it in the
example). To set the cursor focus, I am usingdef OnSearch(self, event):
CommonName = self.CommonNameTXT.GetValue()
if CommonName != '':
ind = self.parent.EnglishNameList.index(CommonName)
self.parent.SpeciesGrid.SetGridCursor(ind, 0)
self.parent.SpeciesGrid.MakeCellVisible(ind,0)Theoretically, it should work using only the SetGridCursor method,
however somewhere I have read that it will not work unless you also
use the MaceCellVisible method as well. Anyway, it does not work at
all. Can anyone help?It's working for me. What platform and version are you using? Please
make a small runnable sample that demonstrates the problem.
MakingSampleApps - wxPyWikiOops! I forgot to attach the runnable example. Sorry, find it attached.
Please, note that only the English Name control is working. It returns
the correct row number to the terminal, but it doesn't set the cursor
focus to any row. I am using Linux Ubuntu Lucid Lynx, Python 2.6.5 and
wx.python 2.8.11. I hope it helps.Ah, you didn't mention that you are using row selection mode...
SetGridCursor is moving the cursor (the thicker lines around the
current cell) just as the code is telling it to, it just isn't moving
the row selection. And since the grid does not have the focus (the
Search button does) you can't see the cursor moving because it is
only drawn when the grid has the focus. Adding this to your
OnSelectCell method will make it work more like what you are expecting:self.SpeciesGrid.SelectRow(self.row)
Thank you so much. Not it sets the cursor focus properly. However, if
the searched string is outside the visible region, it does not scroll
the grid to this row. For example, in the new example I provide, if
you search for the "Killdeer", which is outside the visible area, it
focuses the focus on the row of interest but it does not scroll the
grid to make it visible, you have to do it manually. It it possible to
make the grid behave like this?
Cheers!
MakeCellVisible(self, row, col)
should do it.
Werner
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en