this is a question about wxBoxSizer. I am implementing a custom wxWidget like collapsible pane.
The problem is: I have a wxBoxSizer (Sizer1), and I add another wxBoxSizer (Sizer2) as its child. If I change the size of Sizer2, How do I make Sizer1 update it's size, automatically or manually?
I have tried to call Fit() and Layout() on Sizer1 after I call SetSize() on Sizer2, but it doesn't change the size for Sizer1.
Please help, thank you!
Layout in wxWidgets always works from top to bottom and changing the size of a sub-window or sub-sizer will never change the size of the containing window on its own. If you do want this to happen, call Fit()
on the parent window to tell it that should become as big as required by its children. Notice that calling it on the panel will still not be enough, you need to do it on the top level wxFrame
or wxDialog
itself, unless you have some free space in it which can be used to accommodate the increasing panel size.