I have a few panels that constist of 2 wxStaticBoxSizers with different content inside.
I dynamically hide one of these wxStaticBoxSizers depending on a wxChoice.
A do a panel->Layout() to reduce the size of the panel (as it has to shrink/expand after hinding one of the wxStaticBoxSizers).
This works fine until wxWidgets 3.x
Now the panel stays always at the same size.
How can this be fixed without setting a manual fixed size?
Resize Panel after hiding wxStaticBoxSizer Topic is solved
- tierra
- Site Admin
- Posts: 1355
- Joined: Sun Aug 29, 2004 7:14 pm
- Location: Salt Lake City, Utah, USA
- Contact:
Re: Resize Panel after hiding wxStaticBoxSizer
Are the two wxStaticBoxSizers contained in another sizer (either vertical or horizontal box sizer, orientation doesn't matter)?
Another approach is to use the new wxSimpleBook control, which is mean to change pages like a wxNoteook, but without using tabs at all, and only switching pages internally with code.
Another approach is to use the new wxSimpleBook control, which is mean to change pages like a wxNoteook, but without using tabs at all, and only switching pages internally with code.
Re: Resize Panel after hiding wxStaticBoxSizer
If you have a panel that contains a sizer and the sizer contains the two static boxes then you need to do two things: 1) Make sure that both sizer cells are "growable", and 2) Whenever you show/hide a static box you must call sizer->Fit(panel) which will adjust the panels size according to its content.
I have a bad habbit of not testing the code I post
Re: Resize Panel after hiding wxStaticBoxSizer
Thanks for your quick answers.
I will try that, just to make it a bit clearer:
The 2 StaticBoxSizers (vertical) which both hold different Controls are in a BoxSizer (vertical) which is attached to a Panel.
I mostly need (context sensitive) just one of the StaticBoxSizers at a time, but in one case I need both of them shown at the same time. So I need different scenarios (hiding/showing) and the Panel should automatically resize.
I will try that, just to make it a bit clearer:
The 2 StaticBoxSizers (vertical) which both hold different Controls are in a BoxSizer (vertical) which is attached to a Panel.
I mostly need (context sensitive) just one of the StaticBoxSizers at a time, but in one case I need both of them shown at the same time. So I need different scenarios (hiding/showing) and the Panel should automatically resize.
- tierra
- Site Admin
- Posts: 1355
- Joined: Sun Aug 29, 2004 7:14 pm
- Location: Salt Lake City, Utah, USA
- Contact:
Re: Resize Panel after hiding wxStaticBoxSizer
Oh, forget about wxSimplebook then, it doesn't do that.Samfox2 wrote:but in one case I need both of them shown at the same time
Nothing about your descriptions so far though sound impossible. Usually just takes the appropriate calls to the various Layout() and Fit() methods on the top level window containing the main panel after hiding/showing either of them.
Re: Resize Panel after hiding wxStaticBoxSizer
Code: Select all
sizer->Fit(panel)