News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Migrating from wxWidgets 2.8 to 2.9 I get alert about sizer generated by wxSmith

Started by eranon, June 10, 2012, 09:29:53 PM

Previous topic - Next topic

eranon

Good evening. I've recently switched from wxWidgets 2.8.12 to 2.9.3 and the DEBUG target of my project (compiled with MSVC9) reports me two debug alerts : one about wx, so I've asked in wx forum and one which seems to be related to sizers. I've attached the alert box.

Also, in this page http://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets, it's said that :
QuotewxGridSizer and wxFlexGridSizer
In wx2.8 and earlier, if you create a 2x2 gridsizer and then add 5 items to it, wx would roll its eyes but quietly make a 5-item grid. In wx2.9 the same code will still work, but will also assert. The best solution is to ask for a 0x2 gridsizer instead. This specifies that the sizer will always have 2 columns, and the number of rows will be calculated automatically. (Alternatively a 2x0 gridsizer will specify always 2 rows.)

So, what to do ? Do I have to regenerate my GUI (I hope not :o) or is there a simple way to fix the problem through the wxSmith graphic editor ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

Did you try to set the apprpriate cols or rows to 0 or the correct size ?
We had some xrc with incorrect col/row numbers in C::B, that did not lead to an assert message, but a crash when loading the xrc (with wx2.9).

eranon

Quote from: oBFusCATed on June 10, 2012, 10:09:41 PM
How have you generated the GUI? wxSmith?
Yes, I did-it with wxSmith in a wx28-based project ; now migrated to wx29.

QuoteDid you try to set the apprpriate cols or rows to 0 or the correct size ?
I have to take a look to tell you, jens. My GUI uses several BoxSizers, GridBagSizers, FlexGridSizers and StaticBoxSizers : so, I've to see all of this closer... I'll tell you...

--
EDIT#1 : well, the line the alert talks about is the 91, here :
89 : GridBagSizer1 = new wxGridBagSizer(0, 0);
90 : GridBagSizer1->AddGrowableCol(2);
91 : GridBagSizer1->AddGrowableRow(3);


--
EDIT #2 : well, all was about GridBagSizers. The alerts (with a "s" since I got others during modification of the UI) told me growable col(s) and row(s) were outside of possible index, while the indexes I passed were fully valids :( So, I've reagenced my GUI without any GridBagSizer (but replacing them with Flex and BoxSizers) and now it's OK :)
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]