Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: recobb on December 16, 2010, 02:26:39 am

Title: wxSmith / FlexGridSizer question
Post by: recobb on December 16, 2010, 02:26:39 am
Howdy,

I'm new to wxWidgets and Codeblocks, but starting to find my way around.  Here's a question on a minor level.  I'm using a flexgridsizer to hold a couple of items, and I'm trying to control the height proportion of those items as the window changes size.  I've checked the Proportion boxes in wxSmith for the respective items (a tabbed notebook and a text control) that are within the sizer, and set relative proportion values, but these seem to be ignored.  I've also set the Growable cols and Growable rows in the wxFlexGridSizer properties sheet.

But my proportions seem to be ignored, with both controls being the same height.  If I look in the generated code, I can modify these two lines:
    FlexGridSizer1->AddGrowableRow(1);
    FlexGridSizer1->AddGrowableRow(2);
To be:
    FlexGridSizer1->AddGrowableRow(1,5);
    FlexGridSizer1->AddGrowableRow(2,1);

And then it works exactly as I wish.  My problem - those lines are in the automatically generated section, and are rewritten every time I make any mod in wxSmith.  I could always re-edit those two fields, but I fear, as the project grows beyond this prototype, that there will end up being many such fields that will require editing.

Any hints/tips/tricks to solve this?  And in general?  I am finding it a bit confusing as to where I set sizes, in sizer items, in the parents, or ..., and which flags cause those sizes to be ignored, etc.  I'm basically filling in values here and there until something works, but with distressingly little rationale for what I'm doing... :?

Thanks,

Richard


Title: Re: wxSmith / FlexGridSizer question
Post by: vid512 on December 31, 2011, 12:41:32 pm
Bumping this question after year. Is this possible?

Without this capability, the flex sizer is hardly usable at all for me. It shouldn't be too hard to add this functionality, something as simple as "2/5,2/1" or "1(5), 2(1)" syntax in "Growable Rows/Cols" would do the trick.
Title: Re: wxSmith / FlexGridSizer question
Post by: MortenMacFly on January 01, 2012, 08:06:05 pm
Bumping this question after year. Is this possible?
Works for me just fine. At least I cannot reproduce. If I enter e.g. 1,2 in the respective field, than that's what is being generated correctly.
Title: Re: wxSmith / FlexGridSizer question
Post by: vid512 on January 01, 2012, 09:33:23 pm
When I enter "2,3,4" in "Growable rows", the generated code is
   fields_sizer->AddGrowableRow(2);
   fields_sizer->AddGrowableRow(3);
   fields_sizer->AddGrowableRow(4);
However, what I want is:
   fields_sizer->AddGrowableRow(2,4);
   fields_sizer->AddGrowableRow(3,1);
   fields_sizer->AddGrowableRow(4,1);

Title: Re: wxSmith / FlexGridSizer question
Post by: MortenMacFly on January 02, 2012, 07:21:25 am
When I enter "2,3,4" in "Growable rows", the generated code is
   fields_sizer->AddGrowableRow(2);
   fields_sizer->AddGrowableRow(3);
   fields_sizer->AddGrowableRow(4);
However, what I want is:
   fields_sizer->AddGrowableRow(2,4);
   fields_sizer->AddGrowableRow(3,1);
   fields_sizer->AddGrowableRow(4,1);
Alight, you want to play with proportions... Well - that's not what is expected as input in he field for wxSmith's FelxGridSizer, so wxSmith does it as designed. However, why don't you just place it outside (after) the wxSmith tags? Then it will remain, even if the wxSmith code is re-created and will supersede what's being generated.
Title: Re: wxSmith / FlexGridSizer question
Post by: vid512 on January 02, 2012, 09:21:01 am
I will try that. Thanks.