X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e345fb0b32bd73a7f2140a1f19c49c344b7b3d1c..9c5c87674aa61beca49b2fe887f2e116cf350e67:/wxPython/wx/lib/scrolledpanel.py diff --git a/wxPython/wx/lib/scrolledpanel.py b/wxPython/wx/lib/scrolledpanel.py index 3b134234cf..122cdde7bd 100644 --- a/wxPython/wx/lib/scrolledpanel.py +++ b/wxPython/wx/lib/scrolledpanel.py @@ -65,10 +65,13 @@ class ScrolledPanel( wx.PyScrolledWindow ): if rate_y: h += rate_y - (h % rate_y) self.SetVirtualSize( (w, h) ) - self.SetVirtualSizeHints( w, h ) + self.SetScrollRate(rate_x, rate_y) + wx.CallAfter(self._SetupAfter) # scroll back to top after initial events - self.SetScrollRate(rate_x, rate_y) - wx.CallAfter(self.Scroll, 0, 0) # scroll back to top after initial events + + def _SetupAfter(self): + self.SetVirtualSize(self.GetBestVirtualSize()) + self.Scroll(0,0) def OnChildFocus(self, evt): @@ -91,7 +94,6 @@ class ScrolledPanel( wx.PyScrolledWindow ): if cr.y < 0 and sppu_y > 0: new_vs_y = vs_y + (cr.y / sppu_y) - # For the right and bottom edges, scroll enough to show the # whole control if possible, but if not just scroll such that # the top/left edges are still visible @@ -112,7 +114,6 @@ class ScrolledPanel( wx.PyScrolledWindow ): else: new_vs_y = vs_y + (cr.y / sppu_y) - # if we need to adjust if new_vs_x != -1 or new_vs_y != -1: #print "%s: (%s, %s)" % (self.GetName(), new_vs_x, new_vs_y)