diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index 7ba024c97f..de6056068e 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -41,6 +41,7 @@ #include "wx/timer.h" // for wxStopWatch #include "wx/colordlg.h" // for wxGetColourFromUser #include "wx/settings.h" +#include "wx/sizer.h" #include "wx/sysopt.h" #include "wx/numdlg.h" @@ -305,6 +306,13 @@ MyFrame::MyFrame(const wxChar *title) #if wxUSE_STATUSBAR CreateStatusBar(); #endif // wxUSE_STATUSBAR + + wxBoxSizer* const sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(m_listCtrl, wxSizerFlags(2).Expand().Border()); + sizer->Add(m_logWindow, wxSizerFlags(1).Expand().Border()); + m_panel->SetSizer(sizer); + + SetClientSize(m_panel->GetBestSize()); } MyFrame::~MyFrame() @@ -315,24 +323,6 @@ MyFrame::~MyFrame() delete m_imageListSmall; } -void MyFrame::OnSize(wxSizeEvent& event) -{ - DoSize(); - - event.Skip(); -} - -void MyFrame::DoSize() -{ - if ( !m_logWindow ) - return; - - wxSize size = GetClientSize(); - wxCoord y = (2*size.y)/3; - m_listCtrl->SetSize(0, 0, size.x, y); - m_logWindow->SetSize(0, y + 1, size.x, size.y - y -1); -} - bool MyFrame::CheckNonVirtual() const { if ( !m_listCtrl->HasFlag(wxLC_VIRTUAL) ) @@ -496,8 +486,6 @@ void MyFrame::RecreateList(long flags, bool withText) m_listCtrl->EnableBellOnNoMatch(mb->IsChecked(LIST_TOGGLE_BELL)); } - DoSize(); - GetMenuBar()->Check(LIST_ROW_LINES, false); m_logWindow->Clear(); diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h index 084362c167..4f4b8a13f4 100644 --- a/samples/listctrl/listtest.h +++ b/samples/listctrl/listtest.h @@ -100,11 +100,7 @@ public: MyFrame(const wxChar *title); virtual ~MyFrame(); - void DoSize(); - protected: - void OnSize(wxSizeEvent& event); - void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); void OnListView(wxCommandEvent& event);