eeschema/add_component setfocus moved into OnInitDialog

SetFocus executed by OnInitDialog wxInitDialogEvent handler
This commit is contained in:
diogocondeco 2017-01-22 22:29:16 +00:00 committed by Wayne Stambaugh
parent b54e77e466
commit 1a05c8a5a8
5 changed files with 12 additions and 4 deletions

View File

@ -44,7 +44,6 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
m_external_browser_requested = false; m_external_browser_requested = false;
m_received_doubleclick_in_tree = false; m_received_doubleclick_in_tree = false;
m_search_container->SetTree( m_libraryComponentTree ); m_search_container->SetTree( m_libraryComponentTree );
m_searchBox->SetFocus();
m_componentDetails->SetEditable( false ); m_componentDetails->SetEditable( false );
m_componentView->SetLayoutDirection( wxLayout_LeftToRight ); m_componentView->SetLayoutDirection( wxLayout_LeftToRight );
@ -71,6 +70,11 @@ DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT()
m_search_container->SetTree( NULL ); m_search_container->SetTree( NULL );
} }
void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& event )
{
m_searchBox->SetFocus();
}
LIB_ALIAS* DIALOG_CHOOSE_COMPONENT::GetSelectedAlias( int* aUnit ) const LIB_ALIAS* DIALOG_CHOOSE_COMPONENT::GetSelectedAlias( int* aUnit ) const
{ {

View File

@ -54,6 +54,7 @@ public:
COMPONENT_TREE_SEARCH_CONTAINER* const aSearchContainer, COMPONENT_TREE_SEARCH_CONTAINER* const aSearchContainer,
int aDeMorganConvert ); int aDeMorganConvert );
virtual ~DIALOG_CHOOSE_COMPONENT(); virtual ~DIALOG_CHOOSE_COMPONENT();
void OnInitDialog( wxInitDialogEvent& event ) override;
/** Function GetSelectedAlias /** Function GetSelectedAlias
* To be called after this dialog returns from ShowModal(). * To be called after this dialog returns from ShowModal().

View File

@ -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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -66,6 +66,7 @@ DIALOG_CHOOSE_COMPONENT_BASE::DIALOG_CHOOSE_COMPONENT_BASE( wxWindow* parent, wx
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // 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_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_UPDATED, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxChange ), NULL, this );
m_searchBox->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxEnter ), 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() DIALOG_CHOOSE_COMPONENT_BASE::~DIALOG_CHOOSE_COMPONENT_BASE()
{ {
// Disconnect Events // 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_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_UPDATED, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxChange ), NULL, this );
m_searchBox->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxEnter ), NULL, this ); m_searchBox->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxEnter ), NULL, this );

View File

@ -67,7 +67,7 @@
<event name="OnHibernate"></event> <event name="OnHibernate"></event>
<event name="OnIconize"></event> <event name="OnIconize"></event>
<event name="OnIdle"></event> <event name="OnIdle"></event>
<event name="OnInitDialog"></event> <event name="OnInitDialog">OnInitDialog</event>
<event name="OnKeyDown"></event> <event name="OnKeyDown"></event>
<event name="OnKeyUp"></event> <event name="OnKeyUp"></event>
<event name="OnKillFocus"></event> <event name="OnKillFocus"></event>

View File

@ -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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -48,6 +48,7 @@ class DIALOG_CHOOSE_COMPONENT_BASE : public DIALOG_SHIM
wxButton* m_stdButtonsCancel; wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class // 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 OnInterceptSearchBoxKey( wxKeyEvent& event ) { event.Skip(); }
virtual void OnSearchBoxChange( wxCommandEvent& event ) { event.Skip(); } virtual void OnSearchBoxChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSearchBoxEnter( wxCommandEvent& event ) { event.Skip(); } virtual void OnSearchBoxEnter( wxCommandEvent& event ) { event.Skip(); }