From ebde977c82fe9fa08e65c497c06b02f4556d4b57 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 25 Jan 2018 16:25:34 -0800 Subject: [PATCH] Fix scrolling regression in DynamicSashWindow --- CHANGES.rst | 3 +++ demo/DynamicSashWindow.py | 6 +++--- wx/lib/gizmos/dynamicsash.py | 23 ++++++++++------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index bec74e389..724c2b26a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -109,6 +109,9 @@ Changes in this release include the following: * Fix problems of the wrong C++ method being called in wx.ProgressDialog on MS Windows. (#701) +* Fixed how the scrollbar events are captured in DynamicSashWindow in order to + fix regression in the sample. (#687) + diff --git a/demo/DynamicSashWindow.py b/demo/DynamicSashWindow.py index f154562c5..96922ec07 100644 --- a/demo/DynamicSashWindow.py +++ b/demo/DynamicSashWindow.py @@ -110,9 +110,9 @@ def OnUnify(self, evt): def runTest(frame, nb, log): if True: - win = gizmos.DynamicSashWindow(nb, -1, #style=0 - #| wxDS_MANAGE_SCROLLBARS - #| wxDS_DRAG_CORNER + win = gizmos.DynamicSashWindow(nb, -1, style=0 + #| gizmos.DS_MANAGE_SCROLLBARS + | gizmos.DS_DRAG_CORNER ) view = TestView(win, -1, log) diff --git a/wx/lib/gizmos/dynamicsash.py b/wx/lib/gizmos/dynamicsash.py index 03b2aebfd..cfda42358 100644 --- a/wx/lib/gizmos/dynamicsash.py +++ b/wx/lib/gizmos/dynamicsash.py @@ -890,19 +890,16 @@ def Create(self): self.Bind(_EVT_DYNAMIC_SASH_REPARENT, self.OnReparent) if self.m_impl.m_window.GetWindowStyle() & DS_MANAGE_SCROLLBARS: - self.m_hscroll.SetEventHandler(self) - self.m_vscroll.SetEventHandler(self) - - - self.Bind(wx.EVT_SET_FOCUS, self.OnFocus) - self.Bind(wx.EVT_SCROLL_TOP, self.OnScroll) - self.Bind(wx.EVT_SCROLL_BOTTOM, self.OnScroll) - self.Bind(wx.EVT_SCROLL_LINEUP, self.OnScroll) - self.Bind(wx.EVT_SCROLL_LINEDOWN, self.OnScroll) - self.Bind(wx.EVT_SCROLL_PAGEUP, self.OnScroll) - self.Bind(wx.EVT_SCROLL_PAGEDOWN, self.OnScroll) - self.Bind(wx.EVT_SCROLL_THUMBTRACK, self.OnScroll) - self.Bind(wx.EVT_SCROLL_THUMBRELEASE, self.OnScroll) + for sbar in [self.m_hscroll, self.m_vscroll]: + sbar.Bind(wx.EVT_SET_FOCUS, self.OnFocus) + sbar.Bind(wx.EVT_SCROLL_TOP, self.OnScroll) + sbar.Bind(wx.EVT_SCROLL_BOTTOM, self.OnScroll) + sbar.Bind(wx.EVT_SCROLL_LINEUP, self.OnScroll) + sbar.Bind(wx.EVT_SCROLL_LINEDOWN, self.OnScroll) + sbar.Bind(wx.EVT_SCROLL_PAGEUP, self.OnScroll) + sbar.Bind(wx.EVT_SCROLL_PAGEDOWN, self.OnScroll) + sbar.Bind(wx.EVT_SCROLL_THUMBTRACK, self.OnScroll) + sbar.Bind(wx.EVT_SCROLL_THUMBRELEASE, self.OnScroll) layout = wx.LayoutConstraints() size = self.m_hscroll.GetBestSize()