Browse Source

Make HTML message box close on escape key.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/6110
6.0.7
Wayne Stambaugh 5 years ago
parent
commit
16b0689841
  1. 13
      common/html_messagebox.cpp
  2. 3
      include/dialog_shim.h
  3. 2
      include/html_messagebox.h

13
common/html_messagebox.cpp

@ -127,3 +127,16 @@ void HTML_MESSAGE_BOX::ShowModeless()
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();
}

3
include/dialog_shim.h

@ -94,7 +94,8 @@ class DIALOG_SHIM : public wxDialog, public KIWAY_HOLDER
*/
void OnButton( wxCommandEvent& aEvent );
void OnCharHook( wxKeyEvent& aEvt );
protected:
virtual void OnCharHook( wxKeyEvent& aEvt );
public:

2
include/html_messagebox.h

@ -38,6 +38,8 @@ protected:
// Handlers for HTML_MESSAGE_BOX_BASE events.
void OnOKButtonClick( wxCommandEvent& event ) override;
virtual void OnCharHook( wxKeyEvent& aEvt ) override;
public:
HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle = wxEmptyString,
const wxPoint& aPosition = wxDefaultPosition,

Loading…
Cancel
Save