Fix ToolTip on Windows
authorLaurent Bessard
Wed, 05 Jun 2013 23:06:01 +0200
changeset 1221 d18ccec78117
parent 1220 16c283246241
child 1222 775b48a2be3b
Fix ToolTip on Windows
controls/CustomToolTip.py
--- a/controls/CustomToolTip.py	Wed Jun 05 00:19:11 2013 +0200
+++ b/controls/CustomToolTip.py	Wed Jun 05 23:06:01 2013 +0200
@@ -50,7 +50,6 @@
         """
         wx.PopupWindow.__init__(self, parent)
         
-        self.CurrentPosition = wx.Point(0, 0)
         self.Restricted = restricted
         
         self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
@@ -126,11 +125,9 @@
         
         # Calculate position of tool tip to stay in screen limits
         tip_width, tip_height = self.GetToolTipSize()
-        self.CurrentPosition = wx.Point(
+        self.SetPosition(wx.Point(
             max(0, min(pos.x, screen_width - tip_width)),
-            max(0, min(pos.y, screen_height - tip_height))) 
-        
-        self.SetPosition(pos)
+            max(0, min(pos.y, screen_height - tip_height))))
     
     def GetToolTipSize(self):
         """
@@ -158,8 +155,7 @@
         # Prevent to call this function if tool tip destroyed
         if self:
             # Refresh tool tip size and position
-            self.SetSize(self.GetToolTipSize())
-            self.SetPosition(self.CurrentPosition)
+            self.SetClientSize(self.GetToolTipSize())
             
             # Redraw tool tip
             self.Refresh()