X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e565667d0f29605c948ad6e742310798e3b2d0d..cb6b81bc94108bcb0a702ac5fdaf4944fa7706a0:/samples/widgets/spinbtn.cpp diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index 8639747e11..6ac58d60bb 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -4,7 +4,6 @@ // Purpose: Part of the widgets sample showing wxSpinButton // Author: Vadim Zeitlin // Created: 16.04.01 -// Id: $Id$ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -197,6 +196,7 @@ BEGIN_EVENT_TABLE(SpinBtnWidgetsPage, WidgetsPage) EVT_TEXT(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinText) EVT_TEXT_ENTER(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinTextEnter) EVT_TEXT(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinText) + EVT_TEXT_ENTER(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinTextEnter) EVT_CHECKBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox) EVT_RADIOBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox) @@ -459,6 +459,19 @@ void SpinBtnWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event)) m_min = minNew; m_max = maxNew; + wxString smax('9', m_textMax->GetValue().length()); + wxSize + size = m_spinctrl->GetSizeFromTextSize(m_spinctrl->GetTextExtent(smax)); + + m_spinctrl->SetMinSize(size); + m_spinctrl->SetSize(size); + + smax += ".0"; + size = m_spinctrldbl->GetSizeFromTextSize( + m_spinctrldbl->GetTextExtent(smax) + ); + m_spinctrldbl->SetMinSize(size); + m_spinctrldbl->SetSize(size); m_spinbtn->SetRange(minNew, maxNew); m_spinctrl->SetRange(minNew, maxNew);