Improve validation of symbol fields editor.
Don't beep when inserting character from focused grid cell (but before editor is opened). Handle reference validation separately from name validation and separately from user field value validation. The old way of setting the fieldId on the validator wasn't working because the validator gets copied. Run validation when leaving cell. Don't just check for empty (particularly for fields that CAN be empty). Fixes: lp:1782917 * https://bugs.launchpad.net/kicad/+bug/1782917 (cherry picked from commit 79e04de)
This commit is contained in:
@@ -41,12 +41,12 @@ GRID_CELL_TEXT_EDITOR::GRID_CELL_TEXT_EDITOR() : wxGridCellTextEditor()
|
||||
}
|
||||
|
||||
|
||||
void GRID_CELL_TEXT_EDITOR::SetValidator(const wxValidator& validator)
|
||||
void GRID_CELL_TEXT_EDITOR::SetValidator( const wxValidator& validator )
|
||||
{
|
||||
// keep our own copy because wxGridCellTextEditor's is annoyingly private
|
||||
m_validator.reset( static_cast<wxValidator*>( validator.Clone() ) );
|
||||
|
||||
wxGridCellTextEditor::SetValidator( validator );
|
||||
wxGridCellTextEditor::SetValidator( *m_validator );
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,11 @@ void GRID_CELL_TEXT_EDITOR::StartingKey( wxKeyEvent& event )
|
||||
m_validator.get()->ProcessEvent( event );
|
||||
}
|
||||
|
||||
if( !event.WasProcessed() )
|
||||
if( event.GetSkipped() )
|
||||
{
|
||||
wxGridCellTextEditor::StartingKey( event );
|
||||
event.Skip( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user