diff --git a/eeschema/dialogs/dialog_label_properties.cpp b/eeschema/dialogs/dialog_label_properties.cpp index 752987d956..2eb68d0651 100644 --- a/eeschema/dialogs/dialog_label_properties.cpp +++ b/eeschema/dialogs/dialog_label_properties.cpp @@ -318,6 +318,33 @@ void DIALOG_LABEL_PROPERTIES::OnEnterKey( wxCommandEvent& aEvent ) } +void DIALOG_LABEL_PROPERTIES::OnValueCharHook( wxKeyEvent& aEvent ) +{ + if( aEvent.GetKeyCode() == WXK_TAB ) + { + if( aEvent.ShiftDown() ) + { + m_textSizeCtrl->SetFocusFromKbd(); + } + else + if( !m_fields->empty() ) + { + m_grid->SetFocusFromKbd(); + m_grid->MakeCellVisible( 0, 0 ); + m_grid->SetGridCursor( 0, 0 ); + } + else + { + m_textSizeCtrl->SetFocusFromKbd(); + } + } + else + { + aEvent.Skip(); + } +} + + static bool positioningChanged( const SCH_FIELD& a, const SCH_FIELD& b ) { if( a.GetPosition() != b.GetPosition() ) diff --git a/eeschema/dialogs/dialog_label_properties.h b/eeschema/dialogs/dialog_label_properties.h index 435d259ae7..92aaeaf764 100644 --- a/eeschema/dialogs/dialog_label_properties.h +++ b/eeschema/dialogs/dialog_label_properties.h @@ -42,6 +42,7 @@ public: private: void OnEnterKey( wxCommandEvent& aEvent ) override; + void OnValueCharHook( wxKeyEvent& aEvent ) override; void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override; void onSpinButton( wxCommandEvent &aEvent ); diff --git a/eeschema/dialogs/dialog_label_properties_base.cpp b/eeschema/dialogs/dialog_label_properties_base.cpp index b5fdf84c16..652d7c39d6 100644 --- a/eeschema/dialogs/dialog_label_properties_base.cpp +++ b/eeschema/dialogs/dialog_label_properties_base.cpp @@ -307,7 +307,9 @@ DIALOG_LABEL_PROPERTIES_BASE::DIALOG_LABEL_PROPERTIES_BASE( wxWindow* parent, wx // Connect Events this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnUpdateUI ) ); + m_valueSingleLine->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnValueCharHook ), NULL, this ); m_valueSingleLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnEnterKey ), NULL, this ); + m_valueCombo->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnValueCharHook ), NULL, this ); m_valueCombo->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnEnterKey ), NULL, this ); m_syntaxHelp->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnFormattingHelp ), NULL, this ); m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnSizeGrid ), NULL, this ); @@ -321,7 +323,9 @@ DIALOG_LABEL_PROPERTIES_BASE::~DIALOG_LABEL_PROPERTIES_BASE() { // Disconnect Events this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnUpdateUI ) ); + m_valueSingleLine->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnValueCharHook ), NULL, this ); m_valueSingleLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnEnterKey ), NULL, this ); + m_valueCombo->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnValueCharHook ), NULL, this ); m_valueCombo->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnEnterKey ), NULL, this ); m_syntaxHelp->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnFormattingHelp ), NULL, this ); m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnSizeGrid ), NULL, this ); diff --git a/eeschema/dialogs/dialog_label_properties_base.fbp b/eeschema/dialogs/dialog_label_properties_base.fbp index a8e2754557..2edfca5ffb 100644 --- a/eeschema/dialogs/dialog_label_properties_base.fbp +++ b/eeschema/dialogs/dialog_label_properties_base.fbp @@ -198,6 +198,7 @@ + OnValueCharHook OnEnterKey @@ -325,6 +326,7 @@ + OnValueCharHook OnEnterKey diff --git a/eeschema/dialogs/dialog_label_properties_base.h b/eeschema/dialogs/dialog_label_properties_base.h index 2eca951bf5..cb5cf01fd8 100644 --- a/eeschema/dialogs/dialog_label_properties_base.h +++ b/eeschema/dialogs/dialog_label_properties_base.h @@ -98,6 +98,7 @@ class DIALOG_LABEL_PROPERTIES_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void OnValueCharHook( wxKeyEvent& event ) { event.Skip(); } virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); } virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); } virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); }