[Boa Constr] Re: simple way to find table row in grid
Status: Beta
Brought to you by:
riaan
From: Werner F. B. <wer...@fr...> - 2005-12-04 11:34:53
|
Hi Paul, No idea, why don't you ask on wxPython. See you Werner paul sorenson wrote: > paul sorenson wrote: > >> I have some code in a Grid OnMouseMotion handler: >> >> x, y = event.GetPosition() >> table = self.GetTable() >> rowobj = table[self.YToRow(y)] >> >> Now YToRow() apparently yields the visible row index, which is not >> necessarily the index into the GridTableBase data (it is if the first >> visible row is also the first table row). Apart from searching >> for the row I want, is there a simple call to get the table index? > > > The closest thing I have is: > > for firstVisibleRow in range(0, self.GetNumberRows() - 1): > if self.IsVisible(firstVisibleRow, 0): > break > rowobj = table[self.YToRow(y) + firstVisibleRow] > > But for some reason that doesn't quite line up with the top and bottom > of each row. > > cheers > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click |