[wxPython-users] Scrollbar help with DynamicSashWindow

Robin Dunn robin at alldunn.com
Fri Mar 2 12:40:42 PST 2007


Danny Shevitz wrote:
> I'm using a DSW to present multiple views of a tree. The DSW has it's 
> own scrollbars.
> Currently as the length of the tree increases, the TreeCtrl puts up it's 
> own scrollbars, So I have
> two scrollbars on the rhs.
> 
> I know DSW's have scrollbar events as in the demo. What I don't 
> understand is how
> to hook up the DSW scrollbars to the TreeCtrl.
> 
> For the demo, the operative lines are:
> self.SetVScrollBar(v_bar)
> self.SetHScrollBar(h_bar)
> 
> But there are no Set[V|H]ScrollBar methods for a TreeCtrl. For a 
> TreeCtrl there is
> a SetScrollbar method, but that just changes the position, not the window.
> 
> So, I'm stuck. What am I supposed to do?

You could try making the TreeCtrls large enough that they don't need to 
display their scrollbars, and then respond to the scroll events from the 
DSW by moving the tree widgets such that the portion that is visible 
(not clipped by their parent) corresponds to the scrollbar positions.  I 
think I would approach it by using a custom panel to hold the treectrl 
and manage sizing it and positioning it.  You can then give it 
Set[V|H]ScrollBar methods like STC so it can hook itself up to the DSW's 
scrollbars.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list