X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9bd25c86704221bb5cf6cbe56b1b593120902ac7..cd15bcaf50ead53ccf9d50965312f0dc754affb4:/samples/widgets/spinbtn.cpp?ds=sidebyside diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index b037345b02..2c039ee279 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -460,6 +460,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);