DestroyChildren deletes ScrolledWindow scrollbars?!?

classic Classic list List threaded Threaded
2 messages Options
bht
Reply | Threaded
Open this post in threaded view
|

DestroyChildren deletes ScrolledWindow scrollbars?!?

bht
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

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: DestroyChildren deletes ScrolledWindow scrollbars?!?

Robin Dunn
bht wrote:

> 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.

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

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.