Method to check WX_UNIT_BINDER value validity.
This commit is contained in:
parent
f7ea9f9136
commit
9c44750ae0
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include "wx_unit_binder.h"
|
||||
|
||||
WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput,
|
||||
WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput,
|
||||
wxStaticText* aUnitLabel, wxSpinButton* aSpinButton ) :
|
||||
m_textCtrl( aTextInput ),
|
||||
m_unitLabel( aUnitLabel ),
|
||||
|
@ -60,7 +60,7 @@ void WX_UNIT_BINDER::SetValue( int aValue )
|
|||
wxString s = StringFromValue( m_units, aValue, false );
|
||||
|
||||
m_textCtrl->SetValue( s );
|
||||
|
||||
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,14 @@ int WX_UNIT_BINDER::GetValue() const
|
|||
}
|
||||
|
||||
|
||||
bool WX_UNIT_BINDER::Valid() const
|
||||
{
|
||||
double dummy;
|
||||
|
||||
return m_textCtrl->GetValue().ToDouble( &dummy );
|
||||
}
|
||||
|
||||
|
||||
void WX_UNIT_BINDER::Enable( bool aEnable )
|
||||
{
|
||||
m_textCtrl->Enable( aEnable );
|
||||
|
|
|
@ -60,6 +60,12 @@ public:
|
|||
*/
|
||||
virtual int GetValue() const;
|
||||
|
||||
/**
|
||||
* Function Valid
|
||||
* Returns true if the text control contains a real number.
|
||||
*/
|
||||
bool Valid() const;
|
||||
|
||||
/**
|
||||
* Function Enable
|
||||
* Enables/diasables the binded widgets
|
||||
|
|
Loading…
Reference in New Issue