]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/spinbtn.cpp
make some reference handling a little more direct and less obscure
[wxWidgets.git] / samples / widgets / spinbtn.cpp
index 8639747e111fad70c8efc46ee2293db3b96f77db..2c039ee2795f50f0f6e7bdd261dec53b9a7d7dff 100644 (file)
@@ -197,6 +197,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 +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);