diff --git a/eeschema/dialogs/dialog_schematic_find.cpp b/eeschema/dialogs/dialog_schematic_find.cpp
index 3d8de0e3ea..88b349931c 100644
--- a/eeschema/dialogs/dialog_schematic_find.cpp
+++ b/eeschema/dialogs/dialog_schematic_find.cpp
@@ -101,6 +101,13 @@ void DIALOG_SCH_FIND::OnClose( wxCloseEvent& aEvent )
}
+void DIALOG_SCH_FIND::OnCancel( wxCommandEvent& aEvent )
+{
+ wxCloseEvent dummy;
+ OnClose( dummy );
+}
+
+
void DIALOG_SCH_FIND::OnUpdateReplaceUI( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( HasFlag( wxFR_REPLACEDIALOG ) && !m_comboFind->GetValue().empty() &&
diff --git a/eeschema/dialogs/dialog_schematic_find.h b/eeschema/dialogs/dialog_schematic_find.h
index e600901221..06456a5982 100644
--- a/eeschema/dialogs/dialog_schematic_find.h
+++ b/eeschema/dialogs/dialog_schematic_find.h
@@ -134,6 +134,7 @@ class DIALOG_SCH_FIND : public DIALOG_SCH_FIND_BASE
protected:
// Handlers for DIALOG_SCH_FIND_BASE events.
void OnClose( wxCloseEvent& aEvent ) override;
+ void OnCancel( wxCommandEvent& aEvent ) override;
void OnSearchForText( wxCommandEvent& aEvent ) override;
void OnTextEnter( wxCommandEvent& event ) override;
void OnOptions( wxCommandEvent& event ) override;
diff --git a/eeschema/dialogs/dialog_schematic_find_base.cpp b/eeschema/dialogs/dialog_schematic_find_base.cpp
index 0ec41a7fa4..027666894a 100644
--- a/eeschema/dialogs/dialog_schematic_find_base.cpp
+++ b/eeschema/dialogs/dialog_schematic_find_base.cpp
@@ -160,6 +160,7 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
m_buttonReplace->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceUI ), NULL, this );
m_buttonReplaceAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnReplace ), NULL, this );
m_buttonReplaceAll->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceAllUI ), NULL, this );
+ m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this );
}
DIALOG_SCH_FIND_BASE::~DIALOG_SCH_FIND_BASE()
@@ -182,5 +183,6 @@ DIALOG_SCH_FIND_BASE::~DIALOG_SCH_FIND_BASE()
m_buttonReplace->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceUI ), NULL, this );
m_buttonReplaceAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnReplace ), NULL, this );
m_buttonReplaceAll->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceAllUI ), NULL, this );
+ m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this );
}
diff --git a/eeschema/dialogs/dialog_schematic_find_base.fbp b/eeschema/dialogs/dialog_schematic_find_base.fbp
index ccd08d4f34..740bba0c70 100644
--- a/eeschema/dialogs/dialog_schematic_find_base.fbp
+++ b/eeschema/dialogs/dialog_schematic_find_base.fbp
@@ -1742,7 +1742,7 @@
-
+ OnCancel
diff --git a/eeschema/dialogs/dialog_schematic_find_base.h b/eeschema/dialogs/dialog_schematic_find_base.h
index bfe30c8ccc..3cc6a7b904 100644
--- a/eeschema/dialogs/dialog_schematic_find_base.h
+++ b/eeschema/dialogs/dialog_schematic_find_base.h
@@ -66,6 +66,7 @@ class DIALOG_SCH_FIND_BASE : public DIALOG_SHIM
virtual void OnReplace( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateReplaceUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnUpdateReplaceAllUI( wxUpdateUIEvent& event ) { event.Skip(); }
+ virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
public:
diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp
index a94e0a171a..f3f90a9317 100644
--- a/eeschema/tools/sch_editor_control.cpp
+++ b/eeschema/tools/sch_editor_control.cpp
@@ -290,7 +290,7 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
if( item )
{
m_selectionTool->AddItemToSel( item );
- getView()->SetCenter( item->GetBoundingBox().GetCenter() );
+ m_frame->FocusOnLocation( item->GetBoundingBox().GetCenter(), true );
m_frame->GetCanvas()->Refresh();
}
else