Eval when needed, but only replace text when killing focus.

Fixes: lp:1800718
* https://bugs.launchpad.net/kicad/+bug/1800718

Fixes: lp:1800476
* https://bugs.launchpad.net/kicad/+bug/1800476
This commit is contained in:
Jeff Young 2018-10-30 22:56:52 +00:00
parent 7b10490256
commit f660ec7cf8
1 changed files with 10 additions and 10 deletions

View File

@ -227,21 +227,21 @@ int UNIT_BINDER::GetValue()
{
auto textEntry = dynamic_cast<wxTextEntry*>( m_value );
auto staticText = dynamic_cast<wxStaticText*>( m_value );
if( m_needsEval && textEntry )
{
if( m_eval.Process( textEntry->GetValue() ) )
textEntry->ChangeValue( m_eval.Result() );
m_needsEval = false;
}
wxString value;
if( textEntry )
return ValueFromString( m_units, textEntry->GetValue(), m_useMils );
{
if( m_needsEval && m_eval.Process( textEntry->GetValue() ) )
value = m_eval.Result();
else
value = textEntry->GetValue();
}
else if( staticText )
return ValueFromString( m_units, staticText->GetLabel(), m_useMils );
value = staticText->GetLabel();
else
return 0;
return ValueFromString( m_units, value, m_useMils );
}