Is it possible to change a sizer's flags after the creation of a sizer? Say I wanted a horizontal BoxSizer to expand only under certain circumstances, or wanted to add and remove the wxRESERVE_SPACE_EVEN_IF_HIDDEN flag?
Secondly, what are the limitations of the wxRESERVE_SPACE_EVEN_IF_HIDDEN? Will it reserve the space if the control is hidden? The sizer hidden? The panel hidden? Is there a way to override it, or will it reserve space no matter what?
Sizer's question
Re: Sizer's question
I am not sure about the wxRESERVE_SPACE_EVENT_IF_HIDDEN flag but you can certainly change proportions during program execution. Check out the layout sample, in particularMorat20 wrote:Is it possible to change a sizer's flags after the creation of a sizer? Say I wanted a horizontal BoxSizer to expand only under certain circumstances, or wanted to add and remove the wxRESERVE_SPACE_EVEN_IF_HIDDEN flag?
Code: Select all
void MyProportionsFrame::UpdateProportions()
You could add some code to that sample to test toggling wxRESERVE_SPACE_EVENT_IF_HIDDEN, you will need to call Layout() after setting the flag to see the effect.
It will reserve all of the space required for all of the items contained in the sizer regardless of the IsShown() state of any of those items.Morat20 wrote:Secondly, what are the limitations of the wxRESERVE_SPACE_EVEN_IF_HIDDEN? Will it reserve the space if the control is hidden? The sizer hidden? The panel hidden? Is there a way to override it, or will it reserve space no matter what?
Re: Sizer's question
Thanks. That covered what I needed to move forward and saved me a few hours of experimentation.
Honestly, the ideal solution to the legacy issue I'm facing would beto use z-order positioning with two separate panels and just swap which one is top, but I don't think I can do that in wxWidgets inside a single notebook tab. (One notebook tab, two panels of identical size)
It looks like I'll have to dynamically deconstruct and reconstruct a chunk of the sizers instead.
Honestly, the ideal solution to the legacy issue I'm facing would beto use z-order positioning with two separate panels and just swap which one is top, but I don't think I can do that in wxWidgets inside a single notebook tab. (One notebook tab, two panels of identical size)
It looks like I'll have to dynamically deconstruct and reconstruct a chunk of the sizers instead.
Re: Sizer's question
Sure you can, just Hide()the current page, call Remove() on it, then call Add() on the other page and Show().
I often keep "stacks" of hidden windows and swap them in/out of notebook pages as needed.
I often keep "stacks" of hidden windows and swap them in/out of notebook pages as needed.