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)