Very weird problem, hard to describe...
the sizer of a wxScrolledWindow contains a LOT of controls that are grouped in their own subsizers. I Hide() and Show() these subsizers according to what controls should be shown.
Now, the bigger of two sizers is only painted as big as the smaller one is. What makes it super weird is that this is only the case every second show/hide iteration, not every time. The scrollbar makes the wxScrolledWindow scroll enough to show all the controls of the bigger subsizer, they just only get painted as big as the smaller subsizer is.
Is there maybe a function to call before Layout that does something like recalculate the size used for painting? maybe the virtual size of the wxScrolledWindow???
EDIT: I am guessing: the controls get painted before the scrollbar size gets updated, so the painting of the controls in the bigger sizer stops when the size of the previously shown smaller sizer is reached?
show/hide controls in wxScrolledWindow
Re: show/hide controls in wxScrolledWindow
No idea. Does the layout fix itself when you resize the window manually?
Use the source, Luke!
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: show/hide controls in wxScrolledWindow
Yes it does! Can I trigger this somehow?
Re: show/hide controls in wxScrolledWindow
First check if it's just a redraw issue by moving a window from another application across yours. If that restores the correct layout, try adding an additional Refresh().
If not, try calling wxWindow::SendSizeEvent() or PostSizeEvent() as a last resort.
If not, try calling wxWindow::SendSizeEvent() or PostSizeEvent() as a last resort.
Use the source, Luke!