How is the easiest way to synchronize two scrollbars?
I have two wxGrid, and the horizontal scrollbars of these have to be synchronized.
What I tried to do was to bind EVT_SCROLLWIN to both of them and then using event.GetPosition() to get the position of the actually scrolled one, and then use grid2.SetScrollPos(pos) to set the scrollbar of the other grid. This do change the position of the second scrollbar, BUT the problem is that the second grid is not updated. I've tried to call grid2.Refresh() and grid2.ForceRefresh(), but it doesn't help.
How is the easiest way to synchronize two scrollbars?
I have two wxGrid, and the horizontal scrollbars of these have to be
synchronized.
What I tried to do was to bind EVT_SCROLLWIN to both of them and then
using event.GetPosition() to get the position of the actually scrolled
one, and then use grid2.SetScrollPos(pos) to set the scrollbar of the
other grid. This do change the position of the second scrollbar, BUT the
problem is that the second grid is not updated. I've tried to call
grid2.Refresh() and grid2.ForceRefresh(), but it doesn't help.
You may want to try something like this instead:
x, y = grid1.GetViewStart()
grid2.Scroll(x, y)
grid2.AdjustScrollbars()
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!