hi,
i earlier posted one question asking whether we can put a ToolTip for the list items in a List Ctrl
Robin replied to this by saying that i need to catch the mouse events for ListCtrl snd detect when mouse is hovering.
Truely speaking robin, i didn’t really get how to proceed.
Anyways i tried doing it in many ways…
in ListCtrl we have only events for mouse click…so i went for " wx.EVT_MOTION"
self.list.Bind(wx.EVT_MOTION, self.OnMouseMove)
def OnMouseMove(self,event):
self.x = event.GetX()
self.y = event.GetY()
item, flags = self.miblist.HitTest((self.x, self.y))
if flags & wx.LIST_HITTEST_ONITEMLABEL
#rect = wx.Rect(self.x,self.y, 20,20)
#self.tip = wx.TipWindow(self, ‘Rect: %s’ % rect)
#self.tip.SetBoundingRect(rect)
#self.tip.Show()
#if item ==0:
rect = wx.Rect(self.x,self.y, 20,20)
tipWin = wx.TipWindow(self.miblist, “Description of item 1”)
tipWin.SetBoundingRect(rect)
what happens is :
-
if i am not using SetBoundingRect(), then the TipWindow diappears only the user clicks.
-
when i set the above function the TipWindow comes but the text is not coming in that window., just a box comes.
really don’t understand wtaz happening. The main prob is i have many list items and for each list item the text in the tip window should change. so it si necessaty that the old tip winder should diappear when the mouse move to the new item.
Also when using TipWindow i am not able to select a list item properly ie, if i try to select by clicking at certain points it won’t be selected. Don’t know why?( iam using wx.EVT_LIST_ITEM_SELECTED for selecting a list item)
MyPanel.py (5.4 KB)
OpenDialog.py (2.23 KB)
···
–
Regards,
Shine Anne