Hi,
First of all. thanks to all the members who develop such an excellent software.
This time let me make a request related to auto-generated code by wxSmith.
I'm testing a wxFrame based program which has fixed sized frame.
I created a new frame based wxSmith project, then deleted the MenuBar1 and the StatusBar1
which are automatically added by default. In this situation, the codes of frame constructor is
as follows.
SizeTestFrame::SizeTestFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(SizeTestFrame)
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
//*)
}
Next, I unchecked the [Default size] checkbox in the property editor, then set Width 300 and Height 200.
The codes of constructor was changed as follows.
SizeTestFrame::SizeTestFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(SizeTestFrame)
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
SetClientSize(wxSize(300,200));
//*)
}
After that, I placed a BoxSizer into the Frame on the GUI designer screen. Then the frame was shrunk
to very small size, and the constructor codes are changed:
SizeTestFrame::SizeTestFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(SizeTestFrame)
wxBoxSizer* BoxSizer1;
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
SetClientSize(wxSize(300,200));
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
SetSizer(BoxSizer1);
BoxSizer1->SetSizeHints(this);
//*)
}
This means the size setting by
SetClientSize(wxSize(300,200)); is ignored.
I suppose it's a spec or a bug of wxWidgets, so I manually added
SetClientSize(wxSize(300,200));again after the auto-generated codes:
SizeTestFrame::SizeTestFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(SizeTestFrame)
wxBoxSizer* BoxSizer1;
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
SetClientSize(wxSize(300,200));
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
SetSizer(BoxSizer1);
BoxSizer1->SetSizeHints(this);
//*)
SetClientSize(wxSize(300,200));
}
Then the frame was shown at the expected size on runtime. But the frame is still shrunk on the
GUI designer even clicking "preview" button.
I think it's better to place
SetClientSize(wxSize(x, y)); at the end of the auto-generated codes,
and it's reflected in the GUI designer screen.
Because programmers sometimes would like to fix the size of frame regardless of its contents.
That's my request.
I would be happy if you consider the request.
Regards,
hirofield