DIALOG_EDIT_ONE_FIELD: use a SCH_FIELD_VALIDATOR for mandatory fields.

These fields do not accept some chars, and must be filtered.
This commit is contained in:
jean-pierre charras 2021-01-03 17:10:16 +01:00
parent a67bf00b9e
commit 51f40a3f2b
1 changed files with 7 additions and 1 deletions

View File

@ -87,7 +87,13 @@ void DIALOG_EDIT_ONE_FIELD::init()
m_CommonConvert->Show( false );
m_CommonUnit->Show( false );
if( !isSymbolEditor && ( m_fieldId == REFERENCE_FIELD || m_fieldId == VALUE_FIELD ) )
// Predefined fields cannot contain some chars, or cannot be empty,
// and need a SCH_FIELD_VALIDATOR (m_StyledTextCtrl cannot use a SCH_FIELD_VALIDATOR).
bool use_validator = m_fieldId == REFERENCE_FIELD
|| m_fieldId == VALUE_FIELD
|| m_fieldId == FOOTPRINT_FIELD
|| m_fieldId == DATASHEET_FIELD;
if( use_validator )
{
m_StyledTextCtrl->Show( false );
SetInitialFocus( m_TextCtrl );