diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp
index b7aec6ec9d..04728a0d56 100644
--- a/eeschema/dialogs/dialog_choose_component.cpp
+++ b/eeschema/dialogs/dialog_choose_component.cpp
@@ -44,7 +44,6 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
m_external_browser_requested = false;
m_received_doubleclick_in_tree = false;
m_search_container->SetTree( m_libraryComponentTree );
- m_searchBox->SetFocus();
m_componentDetails->SetEditable( false );
m_componentView->SetLayoutDirection( wxLayout_LeftToRight );
@@ -71,6 +70,11 @@ DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT()
m_search_container->SetTree( NULL );
}
+void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& event )
+{
+ m_searchBox->SetFocus();
+}
+
LIB_ALIAS* DIALOG_CHOOSE_COMPONENT::GetSelectedAlias( int* aUnit ) const
{
diff --git a/eeschema/dialogs/dialog_choose_component.h b/eeschema/dialogs/dialog_choose_component.h
index 9d83df8c8c..495cc1b4d0 100644
--- a/eeschema/dialogs/dialog_choose_component.h
+++ b/eeschema/dialogs/dialog_choose_component.h
@@ -54,6 +54,7 @@ public:
COMPONENT_TREE_SEARCH_CONTAINER* const aSearchContainer,
int aDeMorganConvert );
virtual ~DIALOG_CHOOSE_COMPONENT();
+ void OnInitDialog( wxInitDialogEvent& event ) override;
/** Function GetSelectedAlias
* To be called after this dialog returns from ShowModal().
diff --git a/eeschema/dialogs/dialog_choose_component_base.cpp b/eeschema/dialogs/dialog_choose_component_base.cpp
index 74cc465fe6..2c332c9533 100644
--- a/eeschema/dialogs/dialog_choose_component_base.cpp
+++ b/eeschema/dialogs/dialog_choose_component_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Mar 28 2015)
+// C++ code generated with wxFormBuilder (version Jan 15 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -66,6 +66,7 @@ DIALOG_CHOOSE_COMPONENT_BASE::DIALOG_CHOOSE_COMPONENT_BASE( wxWindow* parent, wx
this->Centre( wxBOTH );
// Connect Events
+ this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnInitDialog ) );
m_searchBox->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnInterceptSearchBoxKey ), NULL, this );
m_searchBox->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxChange ), NULL, this );
m_searchBox->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxEnter ), NULL, this );
@@ -80,6 +81,7 @@ DIALOG_CHOOSE_COMPONENT_BASE::DIALOG_CHOOSE_COMPONENT_BASE( wxWindow* parent, wx
DIALOG_CHOOSE_COMPONENT_BASE::~DIALOG_CHOOSE_COMPONENT_BASE()
{
// Disconnect Events
+ this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnInitDialog ) );
m_searchBox->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnInterceptSearchBoxKey ), NULL, this );
m_searchBox->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxChange ), NULL, this );
m_searchBox->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxEnter ), NULL, this );
diff --git a/eeschema/dialogs/dialog_choose_component_base.fbp b/eeschema/dialogs/dialog_choose_component_base.fbp
index 57740013b6..a07bd5bca2 100644
--- a/eeschema/dialogs/dialog_choose_component_base.fbp
+++ b/eeschema/dialogs/dialog_choose_component_base.fbp
@@ -67,7 +67,7 @@
-
+ OnInitDialog
diff --git a/eeschema/dialogs/dialog_choose_component_base.h b/eeschema/dialogs/dialog_choose_component_base.h
index f3b3c704f7..4d1fa40774 100644
--- a/eeschema/dialogs/dialog_choose_component_base.h
+++ b/eeschema/dialogs/dialog_choose_component_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Mar 28 2015)
+// C++ code generated with wxFormBuilder (version Jan 15 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -48,6 +48,7 @@ class DIALOG_CHOOSE_COMPONENT_BASE : public DIALOG_SHIM
wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class
+ virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnInterceptSearchBoxKey( wxKeyEvent& event ) { event.Skip(); }
virtual void OnSearchBoxChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSearchBoxEnter( wxCommandEvent& event ) { event.Skip(); }