Hi,
A few days ago, I posted almost the same message as this on "General" forum.
But I think that forum is not appropriate to post this kind of message,
so let me post it on this board again.
I have a request for auto-generated codes by wxSmith.
I'm testing a frame which has fixed size.
I created a new frame based wxSmith project by the wizard, then deleted the
MenuBar1 and the StatusBar1 which are automatically added by default.
The followings are the codes of frame constructor in this situation.
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 to 300 and Height to 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.
So I added
SetClientSize(wxSize(300,200)); again after the auto-generated codes
by manual as follows:
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 " Show preview"
button.
Although I guess it might be a kind of spec or bug of wxWidgets, but I think
it's better that wxSmith places
SetClientSize(wxSize(x, y)); at the end of the
auto-generated codes of constructor, and it's reflected in the GUI designer
screen.
In addition, I think it affects the usability of the GUI designer. Actually,
it's rather difficult for me to place a widgets on the exact position in the
narrow space.
That's my request.
I would be happy if this issue is resolved.
Regards,
hirofield