Hand-code tab navigation from value field of Label Properties dialog.
wxWidgets doesn't appear to handle it correctly, doing nothing on OSX and potentially crashing on GTK. Fixes https://gitlab.com/kicad/code/kicad/issues/11572
This commit is contained in:
parent
5f7ac58f95
commit
a644aad1cf
|
@ -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 )
|
static bool positioningChanged( const SCH_FIELD& a, const SCH_FIELD& b )
|
||||||
{
|
{
|
||||||
if( a.GetPosition() != b.GetPosition() )
|
if( a.GetPosition() != b.GetPosition() )
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnEnterKey( wxCommandEvent& aEvent ) override;
|
void OnEnterKey( wxCommandEvent& aEvent ) override;
|
||||||
|
void OnValueCharHook( wxKeyEvent& aEvent ) override;
|
||||||
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
|
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
|
||||||
|
|
||||||
void onSpinButton( wxCommandEvent &aEvent );
|
void onSpinButton( wxCommandEvent &aEvent );
|
||||||
|
|
|
@ -307,7 +307,9 @@ DIALOG_LABEL_PROPERTIES_BASE::DIALOG_LABEL_PROPERTIES_BASE( wxWindow* parent, wx
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnUpdateUI ) );
|
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_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_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_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 );
|
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
|
// Disconnect Events
|
||||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnUpdateUI ) );
|
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_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_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_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 );
|
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_LABEL_PROPERTIES_BASE::OnSizeGrid ), NULL, this );
|
||||||
|
|
|
@ -198,6 +198,7 @@
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
|
<event name="OnCharHook">OnValueCharHook</event>
|
||||||
<event name="OnTextEnter">OnEnterKey</event>
|
<event name="OnTextEnter">OnEnterKey</event>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
@ -325,6 +326,7 @@
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
|
<event name="OnCharHook">OnValueCharHook</event>
|
||||||
<event name="OnTextEnter">OnEnterKey</event>
|
<event name="OnTextEnter">OnEnterKey</event>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -98,6 +98,7 @@ class DIALOG_LABEL_PROPERTIES_BASE : public DIALOG_SHIM
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnValueCharHook( wxKeyEvent& event ) { event.Skip(); }
|
||||||
virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); }
|
virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); }
|
||||||
virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); }
|
virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); }
|
||||||
|
|
Loading…
Reference in New Issue