DestroyChildren deletes ScrolledWindow scrollbars?!?

20 views
Skip to first unread message

bht

unread,
May 17, 2013, 11:24:50 AM5/17/13
to wxpytho...@googlegroups.com
I was having problems where a wx.ScrolledWindow was not showing scroll bars (this is with wx 2.8.10.1 running on a Mac). The problem was fixed by changing this:

    win.DestroyChildren()

to this:

    if win.GetSizer(): win.GetSizer().Clear(True)

in the routine that filled the contents of the ScrolledWindow. I have a feeling that this may be platform-specific behavior.

I did a fair amount of review of documentation etc. and did not find anything that says "don't use DestroyChildren with ScrolledWindow" so I wanted to get this down here to perhaps save someone else some time.

Brian

Robin Dunn

unread,
May 17, 2013, 9:01:03 PM5/17/13
to wxpytho...@googlegroups.com
Yes, on the Mac the scrollbars used on wx.ScrolledWindow are
wx.ScrollBars and are mostly normal children of the window. On the
other platforms the scrollbars are implemented by the native window and
so we don't see them as normal children of the scrolled window. There
is a method you can use to determine if a child is one of the special
scrollbars, MacIsWindowScrollbar.


--
Robin Dunn
Software Craftsman
http://wxPython.org
Reply all
Reply to author
Forward
0 new messages