X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/261357eb0ad855b642fe68a84c9ad2b727a926cb..ba59de5d95df686101f44abcdc2dec9f6f464e2a:/samples/widgets/spinbtn.cpp diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index 125d533bf3..63f8e9c353 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -80,6 +80,9 @@ public: virtual wxControl *GetWidget2() const { return m_spinctrl; } virtual void RecreateWidget() { CreateSpin(); } + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnButtonReset(wxCommandEvent& event); @@ -197,7 +200,10 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book, m_spinbtn = (wxSpinButton *)NULL; m_sizerSpin = (wxSizer *)NULL; +} +void SpinBtnWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -260,8 +266,6 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book, // final initializations SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- @@ -347,7 +351,7 @@ void SpinBtnWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event)) maxNew = 0; // init to suppress compiler warning if ( !m_textMin->GetValue().ToLong(&minNew) || !m_textMax->GetValue().ToLong(&maxNew) || - minNew >= maxNew ) + minNew > maxNew ) { wxLogWarning(_T("Invalid min/max values for the spinbtn.")); @@ -386,7 +390,7 @@ void SpinBtnWidgetsPage::OnUpdateUIMinMaxButton(wxUpdateUIEvent& event) long mn, mx; event.Enable( m_textMin->GetValue().ToLong(&mn) && m_textMax->GetValue().ToLong(&mx) && - mn < mx); + mn <= mx); } void SpinBtnWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)