Author Topic: [SOLVED] wxSmith SetSizer generation error  (Read 7227 times)

Offline paulcrown

  • Single posting newcomer
  • *
  • Posts: 3
[SOLVED] wxSmith SetSizer generation error
« on: September 23, 2013, 06:23:52 pm »
Greetings,

I am using Code::Blocks svn build rev 9156 with wxWidgets 2.9.5 on Xubuntu 12.04 LTS AMD64.

I have created a Frame with a Panel, multiple sizers, a Notebook with multiple grids with wxSmith.  wxSmith generates multiple SetSizer() lines in the code, one that works, and one that error at runtime.

Code
        noteFirm->SetSizer(boxFirm);            // correct
SetSizer(boxFirm);                      // will error at runtime
Layout();

I have read in other posts that the top Panel should use wxDefaultSize.  Mine does, however, I have set a size for the Frame.  I want the Frame an exact size and not resizable.

Code
        Create(parent, wxID_ANY, _("E-E-A"), wxDefaultPosition, wxDefaultSize,   wxCAPTION|wxCLOSE_BOX|wxFRAME_TOOL_WINDOW|wxTAB_TRAVERSAL|wxDOUBLE_BORDER|wxRAISED_BORDER, _T("wxID_ANY"));
SetClientSize(wxSize(1000,700));
panelMain = new wxPanel(this, ID_panelMain, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_panelMain"));

My temp solution for the moment has been to create a private function within the Frame's class called SetSizer (that I want to share to those others who are having the same difficulty).

Code
	private:
            void SetSizer(wxBoxSizer*) {};      // remove wxSmith errors


However, I was wondering if there is a "correct" way to prevent wxSmith from generating these extra SetSizer lines?

Thank you.

Paul Crown

« Last Edit: September 30, 2013, 04:31:29 pm by paulcrown »

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wxSmith SetSizer generation error
« Reply #1 on: September 23, 2013, 06:41:32 pm »
Can you create a minimal project that leads to the error and attach it here ?

Offline paulcrown

  • Single posting newcomer
  • *
  • Posts: 3
Re: wxSmith SetSizer generation error
« Reply #2 on: September 24, 2013, 01:12:25 am »
After much experimentation, I find that I do have another Panel, and it does have a non-DefaultSize.  Removing size from all panels fixed the problem.

Attached is a sample wxSmith file to use to reproduce the issue.  The size added to noteOne will cause the error.

frmHello.wxs
Code
<?xml version="1.0" encoding="utf-8" ?>
<wxsmith>
<object class="wxFrame" name="frmHello">
<title>Hello World</title>
<object class="wxPanel" name="ID_panelMain" variable="panelMain" member="yes">
<object class="wxBoxSizer" variable="boxMain" member="no">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxNotebook" name="ID_nbMain" variable="nbMain" member="yes">
<size>975,430</size>
<object class="notebookpage">
<object class="wxPanel" name="ID_noteOne" variable="noteOne" member="yes">
<size>560,205</size>
<object class="wxBoxSizer" variable="boxOne" member="no" />
</object>
<label>1</label>
</object>
<object class="notebookpage">
<object class="wxPanel" name="ID_noteTwo" variable="noteTwo" member="yes">

<object class="wxBoxSizer" variable="boxTwo" member="no" />
</object>
<label>2</label>
</object>
<object class="notebookpage">
<object class="wxPanel" name="ID_noteThree" variable="noteThree" member="yes">

<object class="wxBoxSizer" variable="boxThree" member="no" />
</object>
<label>3</label>
</object>
</object>
<flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
</object>
</object>
</object>
</object>
</wxsmith>

Ok, having learned more, I know that I have to take size off of all Panels.

I'm not complaining, but would request a future change to completely remove the Size Option from wxPanels in wxSmith.

Thanks.

Paul