Make HTML message box close on escape key.
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/6110
This commit is contained in:
parent
1f21a93b39
commit
16b0689841
|
@ -127,3 +127,16 @@ void HTML_MESSAGE_BOX::ShowModeless()
|
||||||
|
|
||||||
Show( true );
|
Show( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HTML_MESSAGE_BOX::OnCharHook( wxKeyEvent& aEvent )
|
||||||
|
{
|
||||||
|
// shift-return (Mac default) or Ctrl-Return (GTK) for OK
|
||||||
|
if( aEvent.GetKeyCode() == WXK_ESCAPE )
|
||||||
|
{
|
||||||
|
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
aEvent.Skip();
|
||||||
|
}
|
||||||
|
|
|
@ -94,7 +94,8 @@ class DIALOG_SHIM : public wxDialog, public KIWAY_HOLDER
|
||||||
*/
|
*/
|
||||||
void OnButton( wxCommandEvent& aEvent );
|
void OnButton( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
void OnCharHook( wxKeyEvent& aEvt );
|
protected:
|
||||||
|
virtual void OnCharHook( wxKeyEvent& aEvt );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ protected:
|
||||||
// Handlers for HTML_MESSAGE_BOX_BASE events.
|
// Handlers for HTML_MESSAGE_BOX_BASE events.
|
||||||
void OnOKButtonClick( wxCommandEvent& event ) override;
|
void OnOKButtonClick( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
|
virtual void OnCharHook( wxKeyEvent& aEvt ) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle = wxEmptyString,
|
HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle = wxEmptyString,
|
||||||
const wxPoint& aPosition = wxDefaultPosition,
|
const wxPoint& aPosition = wxDefaultPosition,
|
||||||
|
|
Loading…
Reference in New Issue