wxSizer question

Herb Rose hrose56 at yahoo.com
Thu Aug 3 09:03:35 PDT 2006


Hi all,

I am having a little difficulty getting a wxBoxSizer to behave the way that I 
want.  My main window (wxFrame) has a vertical sizer, into which I add 
several horizontal sizers.  The horizontal sizers all have a label, a 
wxSpinCtrl, and a variable number of text controls.  Changing the value in 
the spin control increases or decreases the number of text controls in each 
horizontal sizer.  I use wxSizer::Show() to hide or display the text controls 
by index.  This works great.  I use the proportion argument to keep the label 
and spin control set to a fixed size, and allow the text controls to expand 
or contract when one is hidden or shown.  Again, it all works great.  If I 
decrease the spin control, a text element disappears, and the other text 
controls grow proportionally.  Likewise, adding a text control causes the 
others to decrease in width and shift left.The horizontal sizers remain the 
same size. This is exactly the behavior I want.

But, if I then I resize the main window, everything changes.  At that point, 
all the text controls revert to their original (minimum) size, and the 
horizontal sizers all get adjusted to a new size.  I have tried creating the 
sizers with and without the wxADJUST_MINSIZE flag, and also with and without 
the wxEXPAND flag.  Logically, I should be using the wxADJUST_MINSIZE flag, 
but not the wxEXPAND flag to get the desired results, I think.

So, my question is : is there a combination of flags that I should be using on 
the sizers to force them to remain the same size when the parent window is 
resized?

Thanks,

Herb

-- 
What lies before us and what lies behind us are tiny matters
compared to what lies within us.   RW Emerson




More information about the wx-users mailing list