Author Topic: wxSmith and wxGridBagSizer  (Read 8428 times)

Offline winnie

  • Single posting newcomer
  • *
  • Posts: 9
wxSmith and wxGridBagSizer
« 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);
    //*)


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxSmith and wxGridBagSizer
« Reply #1 on: April 11, 2018, 10:23:04 am »
Why?
(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!]

Offline winnie

  • Single posting newcomer
  • *
  • Posts: 9
Re: wxSmith and wxGridBagSizer
« Reply #2 on: April 13, 2018, 05:04:45 pm »
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: wxSmith and wxGridBagSizer
« Reply #3 on: April 13, 2018, 07:55:56 pm »
winnie: What Code::Blocks version?
What operating system version?
What wxWidgets version are you using to build your C:B: project?

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: wxSmith and wxGridBagSizer
« Reply #4 on: April 14, 2018, 06:35:54 pm »
I can reproduce this...
This new wxWidgets asserts are annoying as fuck....

will try to create a fix....

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxSmith and wxGridBagSizer
« Reply #5 on: April 14, 2018, 06:58:17 pm »
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.
(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!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: wxSmith and wxGridBagSizer
« Reply #6 on: April 15, 2018, 10:38:00 pm »
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


« Last Edit: April 16, 2018, 12:34:53 am by BlueHazzard »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxSmith and wxGridBagSizer
« Reply #7 on: April 29, 2018, 06:28:04 pm »
Should be fixed in trunk.
(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!]