Frame::Frame() : m_logCnt(0), m_dlgFind(NULL)
{
//(*Initialize(Frame)
...
Create(0, wxID_ANY, _("Parser Testing"), wxDefaultPosition, wxSize(800,550), wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
sizer = new wxBoxSizer(wxHORIZONTAL);
...
sizer->Fit(this);
sizer->SetSizeHints(this);
Center();
...
//*)
m_statuBar->SetStatusText(_("Ready!"));
}
Frame::Frame() : m_logCnt(0), m_dlgFind(NULL)
{
//(*Initialize(Frame)
...
Create(0, wxID_ANY, _("Parser Testing"), wxDefaultPosition, wxSize(800,550), wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
sizer = new wxBoxSizer(wxHORIZONTAL);
...
SetSizer(sizer);
Layout();
Center();
...
//*)
m_statuBar->SetStatusText(_("Ready!"));
}
Index: src/plugins/contrib/wxSmith/wxwidgets/wxscontainer.cpp
===================================================================
--- src/plugins/contrib/wxSmith/wxwidgets/wxscontainer.cpp (revision 6197)
+++ src/plugins/contrib/wxSmith/wxwidgets/wxscontainer.cpp (working copy)
@@ -209,21 +209,32 @@
wxsItem* Child = GetChild(i);
if ( Child->GetType() == wxsTSizer )
{
- wxString ChildAccessPrefix = Child->GetAccessPrefix(GetLanguage());
if ( GetBaseProps()->m_Size.IsDefault )
{
+ wxString ChildAccessPrefix = Child->GetAccessPrefix(GetLanguage());
#if wxCHECK_VERSION(2, 9, 0)
Codef(_T("%sFit(%O);\n"),ChildAccessPrefix.wx_str());
#else
Codef(_T("%sFit(%O);\n"),ChildAccessPrefix.c_str());
#endif
+
+ #if wxCHECK_VERSION(2, 9, 0)
+ Codef(_T("%sSetSizeHints(%O);\n"),ChildAccessPrefix.wx_str());
+ #else
+ Codef(_T("%sSetSizeHints(%O);\n"),ChildAccessPrefix.c_str());
+ #endif
}
+ else
+ {
+ wxString ChildVarName = Child->GetVarName();
+ #if wxCHECK_VERSION(2, 9, 0)
+ Codef(_T("SetSizer(%s);\n"), ChildVarName.wx_str());
+ #else
+ Codef(_T("SetSizer(%s);\n"), ChildVarName.c_str());
+ #endif
- #if wxCHECK_VERSION(2, 9, 0)
- Codef(_T("%sSetSizeHints(%O);\n"),ChildAccessPrefix.wx_str());
- #else
- Codef(_T("%sSetSizeHints(%O);\n"),ChildAccessPrefix.c_str());
- #endif
+ Codef(_T("Layout();\n"));
+ }
}
}
[...]
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
SetClientSize(wxSize(450,150));
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
SetSizer(BoxSizer1);
[...]
BoxSizer1->SetSizeHints(this);
[...]
This is a snippet if I create a simple test project with a frame containing a boxsizer and syet the frames size to a fixed size:Quote[...]
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
SetClientSize(wxSize(450,150));
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
SetSizer(BoxSizer1);
[...]
BoxSizer1->SetSizeHints(this);
[...]
And I don't see what is wrong.
It works and it does more or less exactly what the wxWidgets docu suggests to do with a (box)sizer (according to the sizer overview.
Maybe I am wrong, but I don't know why it should be done the other way.
Loaden:
could you please explain what is wrong doing it this way and/or point me to the part of the wxWidgets documentation that describes why it should be done this way ?
Create(0, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));NOTICE: The logCtrl use wxDefaultSize, but NOT wxSize(x, y).
SetClientSize(wxSize(450,150));
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
wxTextCtrl* logCtrl = new wxTextCtrl(this, wxNewId(), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL | wxTE_RICH2, wxDefaultValidator, _T("ID_LOGMAIN"));
sizer->Add(logCtrl, 1, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
SetSizer(sizer);
sizer->SetSizeHints(this);
Create(0, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));It's work well.
SetClientSize(wxSize(450,150));
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
wxTextCtrl* logCtrl = new wxTextCtrl(this, wxNewId(), wxEmptyString, wxDefaultPosition, wxSize(800, 600), wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL | wxTE_RICH2, wxDefaultValidator, _T("ID_LOGMAIN"));
sizer->Add(logCtrl, 1, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
SetSizer(sizer);
sizer->SetSizeHints(this);