[wxPython-users] how to scroll wx.Window horizontally?

Pan Xingzhi vengeance.storm at gmail.com
Tue Jan 8 13:11:30 PST 2008


Hi Robin,

    Thank you for the detailed explanation. But for the first point,
if wx doesn't have access to the scrollbars of the non-generic
widgets, why can I add event listeners to TreeCtrl to capture
EVT_SCROLLWIN? Or is there something wrong in my understanding?

Thanks,
    Pan Xingzhi

2008/1/3, Robin Dunn <robin at alldunn.com>:
> Pan Xingzhi wrote:
> > Robin,
> >
> >     Nice to hear from you again in 2008. Thank you for the direction.
> >
> >     I kept asking questions about scrolling because I feel that
> > scrolling in wxPython is a little bit weird, but to accomplish my task
> > I have to thoroughly understand what's going on. There is something
> > unusual but I couldn't tell, until I took some time to think about it,
> > inside and out. Then I realized that in wxPython, both containers and
> > non-containers can have scrolling ability (though it seems that
> > wxPython do not emphasize the difference between the two). So my
> > questions came again. I put my understandings below, please correct me
> > if I'm wrong:
> >
> >     1. For non-container widgets like wx.TreeCtrl, by default,
> > scrollbars show up when the virtual size gets larger than the client
> > size.
>
> Yes, in general.  More specifically, widgets like this manage their own
> scrollbars internally, and wx doesn't really have access to them[*].
> The can be considered as an implementation detail that just happens to
> be used inside the "black box" that is the widget.
>
> [*] The exception of course is if the widget is implemented generically
> using wx itself, but you can't depend on that because for a particular
> widget it may be native on some platforms and generic on others.
>
>
> >     2. The virtual size of non-containers is decided by the content of
> > the non-container widget, e.g., the text in the TextCtrl, items in a
> > TreeCtrl.
>
> Yes.
>
> >     3. For containers, the virtual size is calculated from the size
> > (*not* virtual size) and position of its children (suppose we don't
> > use sizers).
>
> No.  You need to explicitly set the virtual size, although sizers can be
> used to help with this.
>
> >     4. The condition for scrollbars of containers to show up is the
> > same as non-containers.
>
> Scrollbars will be shown if the virtual size is greater than the client
> size.
>
> >
> >     Btw, you guys really should rename wx.ScrolledWindow to
> > ScrolledPanel or something. After all it's a container. A beginner
> > would easily think ScrolledWIndow as a direct child of wx.Window.
> > (However I found a wx.lib.scrolledpanel.ScrolledPanel already occupied
> > the name.)
>
> Yep, this was discussed in the past, but nothing was done because there
> wasn't a clean migration path that made sense that would also preserve
> backwards compatibility.
>
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org  Java give you jitters?  Relax with wxPython!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>




More information about the wxpython-users mailing list