Differences between revisions 4 and 5
Revision 4 as of 2005-09-26 14:22:42
Size: 543
Editor: 3e44adbd
Comment:
Revision 5 as of 2008-03-11 10:50:22
Size: 543
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

HitTest and HitTestXY for wxListBox

This experimental code shows how to implement a working HitTestXY method for wxListBox

   1 class MyListBox(wx.ListBox):
   2     def HitTestXY(self,x,y):
   3         xs,ys = self.GetClientSize()
   4         if (y<0) or (x<0) or (x>=xs) or (y>=ys):
   5             return -1
   6         index = self.GetScrollPos(wx.VERTICAL) + y/self.GetCharHeight()
   7         if index >= self.GetCount():
   8             return -1
   9         return index
  10     def HitTest(self,pos):
  11         return self.HitTestXY(*pos)

wxListBoxHitTest (last edited 2008-03-11 10:50:22 by localhost)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.