diff --git a/eeschema/dialogs/dialog_fields_editor_global.cpp b/eeschema/dialogs/dialog_fields_editor_global.cpp index 17c47779de..e04b73aec3 100644 --- a/eeschema/dialogs/dialog_fields_editor_global.cpp +++ b/eeschema/dialogs/dialog_fields_editor_global.cpp @@ -177,6 +177,11 @@ public: return GetValue( m_rows[ aRow ], aCol ); } + std::vector GetRowReferences( int aRow ) + { + wxCHECK( aRow < m_rows.size(), std::vector() ); + return m_rows[ aRow ].m_Refs; + } wxString GetValue( DATA_MODEL_ROW& group, int aCol ) { @@ -820,9 +825,21 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnRegroupComponents( wxCommandEvent& event ) void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick( wxGridEvent& event ) { if( event.GetCol() == REFERENCE ) - m_dataModel->ExpandCollapseRow( event.GetRow()); + { + m_dataModel->ExpandCollapseRow( event.GetRow() ); + std::vector refs = m_dataModel->GetRowReferences( event.GetRow() ); + + // Focus eeschema view on the component selected in the dialog + if( refs.size() == 1 ) + { + m_parent->FindComponentAndItem( refs[0].GetRef() + refs[0].GetRefNumber(), + true, FIND_COMPONENT_ONLY, wxEmptyString, false ); + } + } else + { event.Skip(); + } }