unit_binder: allow updates without triggers
Adds a helper function to allow unit binder calls that change a value but shouldn't trigger wxevents
This commit is contained in:
parent
49735c219b
commit
9e33d38cd5
|
@ -224,6 +224,26 @@ void UNIT_BINDER::SetValue( wxString aValue )
|
|||
}
|
||||
|
||||
|
||||
void UNIT_BINDER::ChangeValue( int aValue )
|
||||
{
|
||||
ChangeValue( StringFromValue( m_units, aValue, false, m_useMils ) );
|
||||
}
|
||||
|
||||
|
||||
void UNIT_BINDER::ChangeValue( wxString aValue )
|
||||
{
|
||||
if( dynamic_cast<wxTextEntry*>( m_value ) )
|
||||
dynamic_cast<wxTextEntry*>( m_value )->ChangeValue( aValue );
|
||||
else if( dynamic_cast<wxStaticText*>( m_value ) )
|
||||
dynamic_cast<wxStaticText*>( m_value )->SetLabel( aValue );
|
||||
|
||||
if( m_allowEval )
|
||||
m_eval.Clear();
|
||||
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils ) );
|
||||
}
|
||||
|
||||
|
||||
int UNIT_BINDER::GetValue() const
|
||||
{
|
||||
wxString s;
|
||||
|
|
|
@ -75,6 +75,16 @@ public:
|
|||
|
||||
void SetValue( wxString aValue );
|
||||
|
||||
/**
|
||||
* Function ChangeValue
|
||||
* Changes the value (in Internal Units) for the text field, taking care of units conversion
|
||||
* but does not trigger the update routine
|
||||
* @param aValue is the new value.
|
||||
*/
|
||||
virtual void ChangeValue( int aValue );
|
||||
|
||||
void ChangeValue( wxString aValue );
|
||||
|
||||
/**
|
||||
* Function GetValue
|
||||
* Returns the current value in Internal Units.
|
||||
|
|
Loading…
Reference in New Issue