controls/CustomToolTip.py
changeset 1221 d18ccec78117
parent 1172 dff0a4e40808
child 1571 486f94a8032c
--- 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()