From 307a7154b61f80ab91425b5b7704195ae4f73ffb Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 27 Feb 2019 23:55:24 -0800 Subject: [PATCH] DIALOG_SHIM: Enable Cancel button when editing The cancel action was set for the escape key when editing the fields in a dialog. But when the action is a button, we need to ensure that the escape id is set to ANY for processing. Fixes: lp:1818056 * https://bugs.launchpad.net/kicad/+bug/1818056 --- common/dialog_shim.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 581d0a507b..3e04a299db 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -434,10 +434,15 @@ void DIALOG_SHIM::OnCloseWindow( wxCloseEvent& aEvent ) void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent ) { + const int id = aEvent.GetId(); + + // If we are pressing a button to exit, we need to enable the escapeID + // otherwise the dialog does not process cancel + if( id == wxID_CANCEL ) + SetEscapeId( wxID_ANY ); + if( IsQuasiModal() ) { - const int id = aEvent.GetId(); - if( id == GetAffirmativeId() ) { EndQuasiModal( id );