Is there any way to specify the proportion of vertical space taken up by each row in wxFlexGridSizer?
In my case, I am using a wxFlexGridSizer with 3 rows and 2 columns. I would like the first row to take 1/7 of the vertical space, the second row to take 4/7 of the vertical space, and the third row to take 2/7 of the vertical space.
Thanks.
wxFlexGridSizer row height proportions Topic is solved
Re: wxFlexGridSizer row height proportions
wxFlexGridSizer::AddGrowableRow() has a proportion parameter.
Use the source, Luke!
Re: wxFlexGridSizer row height proportions
I am noticing something weird with this dialog (i.e., the one using wxFlexGridSizer) which I haven't seen before with any other. I am now calling AddGrowableRow as you suggested. But, they don't have an impact until I move the dialog a bit.
I do call the following at the end of the dialog's constructor.
To get the proper layout, all that I have to do is just move the dialog. But, when it first shows up, it is not right. As an attempt to get around, I tried calling Refresh or Update at the end of the constructor so that the layout is right when first shown; but, they didn't help.
Any idea?
Thanks.
P.S. Using wxWidgets-3.1.2 on Windows 10.
I do call the following at the end of the dialog's constructor.
Code: Select all
Layout();
wxSizer* pSizer = GetSizer();
if (pSizer)
pSizer->Fit(this);
Any idea?
Thanks.
P.S. Using wxWidgets-3.1.2 on Windows 10.
Last edited by Victory on Thu Jan 10, 2019 8:09 pm, edited 1 time in total.
Re: wxFlexGridSizer row height proportions
Hard to tell without seeing the complete sizer code, but sometimes calling SendSizeEvent() helps.
https://docs.wxwidgets.org/trunk/classw ... 5fa82ba4c2
https://docs.wxwidgets.org/trunk/classw ... 5fa82ba4c2
Is it really about moving? Usually only resizing should have an impact on the layout. I've never seen it happen when moving.But, they don't have an impact until I move the dialog a bit.
Use the source, Luke!
Re: wxFlexGridSizer row height proportions
Either moving or resizing fixes it.
As an experiment I just now added the following code at the end of the constructor:
That makes the dialog have the right layout when it appears. So, I seem to have a work-around for this as of now, though hackish.
As an experiment I just now added the following code at the end of the constructor:
Code: Select all
const wxPoint pos = GetPosition();
Move(pos.x + 1, pos.y + 1);