added NormalizeValue() which can be used to ensure that the control value is in range
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -60,6 +60,9 @@ public:
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// ensure that the control displays a value in the current range
|
||||
void NormalizeValue() { SetValue(GetValue()); }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton)
|
||||
};
|
||||
|
@@ -253,8 +253,8 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event)
|
||||
|
||||
void wxSpinCtrl::OnKillFocus(wxFocusEvent& event)
|
||||
{
|
||||
// ensure that the value is shown correctly
|
||||
SetValue(GetValue()) ;
|
||||
// ensure that a correct value is shown by the control
|
||||
NormalizeValue();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user