Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

wxSmith and wxGridBagSizer

(1/2) > >>

winnie:
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);
    //*)

oBFusCATed:
Why?

winnie:
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.

stahta01:
winnie: What Code::Blocks version?
What operating system version?
What wxWidgets version are you using to build your C:B: project?

Tim S.

BlueHazzard:
I can reproduce this...
This new wxWidgets asserts are annoying as fuck....

will try to create a fix....

Navigation

[0] Message Index

[#] Next page

Go to full version