Automatically adjust wxSpinCtrl size in widgets sample
wxSpinCtrl/wxSpinCtrlDouble best size is adjusted automatically while changing the value range so there is no need to resize the controls manually.
This commit is contained in:
@@ -458,23 +458,12 @@ 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);
|
||||
m_spinctrldbl->SetRange(minNew, maxNew);
|
||||
|
||||
m_sizerSpin->Layout();
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnButtonSetBase(wxCommandEvent& WXUNUSED(event))
|
||||
|
Reference in New Issue
Block a user