I'm not having much luck trying to create a scrolling tri-pane window, with a top panel that only scrolls horizontally, a side panel scrolling vertically, and the main panel scrolling in both direction, very similar to the classic spreadsheet example with the cells and the rows and columns scrolling separately.
The main ScrolledWindow object contains sizers and the 3 panels, but when I use SetTargetWindow() to the panel, the scrollbars disapears. any ideas?
I'm not having much luck trying to create a scrolling tri-pane window, with a top panel that only scrolls horizontally, a side panel scrolling vertically, and the main panel scrolling in both direction, very similar to the classic spreadsheet example with the cells and the rows and columns scrolling separately.
The main ScrolledWindow object contains sizers and the 3 panels, but when I use SetTargetWindow() to the panel, the scrollbars disapears. any ideas?
SetTargetWindow is to be used when you want the scrolling behaviour managed by the ScrolledWindow to take place in one of its children. For example in wx.grid.Grid the child window with the cells is the target window.
If I understand you correctly then I think in your case you want to have ScrolledWindows as the children and let them do their own scrolling, and don't worry about targets
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Actually, what I’m looking for is exactly the same behavior as the
wx.Grid control, except that the 3 areas (main, top, left) I would
paint myself.
`<>±-----±----------±+
> top |s|
±-----±----------+c|
side | main |r|
> >o>
> >l>
``| | |l|
``±-----±----------±+
<>±------scroll-----±+
`>
I was looking at the c++ scroll subwindow example, which suggest
setting the main sub-window as the target window, then re-implementing
the ScrollWindow function to scroll the top and main windows to match.
Can I just do something like this in my
scrolling tri-pane window, with a top panel that only scrolls
horizontally, a side panel scrolling vertically, and the main panel
scrolling in both direction, very similar to the classic spreadsheet
example with the cells and the rows and columns scrolling separately.
The main ScrolledWindow object contains sizers and the 3 panels, but
when I use SetTargetWindow() to the panel, the scrollbars disapears.
any ideas?
SetTargetWindow is to be used when you want the scrolling behaviour
managed by the ScrolledWindow to take place in one of its children.
For example in wx.grid.Grid the child window with the cells is the
target window.
If I understand you correctly then I think in your case you want to
have ScrolledWindows as the children and let them do their own
scrolling, and don’t worry about targets
This won't work as calls to the C++ ScrollWindow won't be reflected to an overridden Python implementation. What you can do instead is catch the EVT_SCROLLWIN events and adjust the top and side windows from there.
OK. this is what I figured so far. I can implement a method to catch the EVT_SCROLLWIN event and do the work within that to scroll the other windows...
def OnScrollWindowEvent(self, event):
"""Custom Event Handler to scroll the windows like a spreadsheet""" #let the real event handler actually scroll the main window
event.Skip() #get the scrollbar positions
dx = self.GetScrollPos(wx.HORIZONTAL)
dy = self.GetScrollPos(wx.VERTICAL) #use that to scroll the other windows
self.topWindow.ScrollWindow(dx, 0)
self.topWindow.ScrollWindow(0, dy)