Code::Blocks Forums
Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: winnie on April 11, 2018, 09:43:21 am
-
When I use a wxGridBagSizer with wxSmith and I set the properties Growable cols and Growable rows wxSmith add the code just after the creation of wxGridBagSizer and not after the elements in the grid are added.
Here is the code generated by wxSmith
wxGridBagSizer* GridBagSizer1;
Create(parent, id, _("wxWidgets app"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX|wxMINIMIZE_BOX, _T("id"));
GridBagSizer1 = new wxGridBagSizer(0, 0);
// !!!! these 5 lines of code should be moved after the elements of the grid are added
GridBagSizer1->AddGrowableCol(0);
GridBagSizer1->AddGrowableCol(1);
GridBagSizer1->AddGrowableRow(0);
GridBagSizer1->AddGrowableRow(1);
GridBagSizer1->AddGrowableRow(2);
Button1 = new wxButton(this, ID_BUTTON1, _("Label"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
GridBagSizer1->Add(Button1, wxGBPosition(0, 0), wxGBSpan(2, 1), wxALL|wxEXPAND, 5);
CheckBox1 = new wxCheckBox(this, ID_CHECKBOX1, _("Label"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
CheckBox1->SetValue(false);
GridBagSizer1->Add(CheckBox1, wxGBPosition(0, 1), wxDefaultSpan, wxALL|wxEXPAND, 5);
Choice1 = new wxChoice(this, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1"));
GridBagSizer1->Add(Choice1, wxGBPosition(1, 1), wxDefaultSpan, wxALL|wxEXPAND, 5);
Button2 = new wxButton(this, ID_BUTTON2, _("Label"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
GridBagSizer1->Add(Button2, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL|wxEXPAND, 5);
SetSizer(GridBagSizer1);
GridBagSizer1->Fit(this);
GridBagSizer1->SetSizeHints(this);
//*)
-
Why?
-
Because when I run the program I get the following error:
../src/common/sizer.cpp(1980): assert "!m_cols || idx < (size_t)m_cols" failed in AddGrowableCol(): invalid column index
It gives the problem only for the columns and not for the rows. I don't know why but if you try in this way it doesn't work.
-
winnie: What Code::Blocks version?
What operating system version?
What wxWidgets version are you using to build your C:B: project?
Tim S.
-
I can reproduce this...
This new wxWidgets asserts are annoying as fuck....
will try to create a fix....
-
No they are not. They report real problems most of the times. The code is broken.
Btw if you don't want to see them define NDEBUG and they'll be gone.
-
Ticket: https://sourceforge.net/p/codeblocks/tickets/664/
We have two problems here:
1) The generated code is not correct. (An assert is triggered by the user application)
2) The code that is used for the preview is also not correct. (An assert is triggered by the wxSmith plugin)
for 1) i have a patch already
fixed both problems in the ticket
-
Should be fixed in trunk.