diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index a7a6803bb3..9f8ffb9936 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -273,12 +273,7 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) if (flags & wxCANCEL) { - // Avoid Cmd+C closing dialog on Mac. - wxString cancelLabel(_("&Cancel")); -#ifdef __WXMAC__ - cancelLabel.Replace("&",wxEmptyString); -#endif - wxButton *cancel = new wxButton(this, wxID_CANCEL, cancelLabel); + wxButton *cancel = new wxButton(this, wxID_CANCEL); sizer->AddButton(cancel); } diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index 3960216686..cefb6c9f58 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -433,12 +433,7 @@ void wxWizard::AddButtonRow(wxBoxSizer *mainColumn) m_finishLabel = _("&Finish"); m_btnNext = new wxButton(this, wxID_FORWARD, m_nextLabel); - // Avoid Cmd+C closing dialog on Mac. - wxString cancelLabel(_("&Cancel")); -#ifdef __WXMAC__ - cancelLabel.Replace("&",wxEmptyString); -#endif - wxButton *btnCancel=new wxButton(this, wxID_CANCEL, cancelLabel, wxDefaultPosition, wxDefaultSize, buttonStyle); + wxButton *btnCancel=new wxButton(this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, buttonStyle); #ifndef __WXMAC__ if (GetExtraStyle() & wxWIZARD_EX_HELPBUTTON) btnHelp=new wxButton(this, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, buttonStyle); diff --git a/src/osx/cocoa/button.mm b/src/osx/cocoa/button.mm index a63c37c7c1..efcc3cb52c 100644 --- a/src/osx/cocoa/button.mm +++ b/src/osx/cocoa/button.mm @@ -187,9 +187,18 @@ void wxButtonCocoaImpl::SetAcceleratorFromLabel(const wxString& label) { wxString accelstring(label[accelPos + 1]); // Skip '&' itself accelstring.MakeLower(); - wxCFStringRef cfText(accelstring); - [GetNSButton() setKeyEquivalent:cfText.AsNSString()]; - [GetNSButton() setKeyEquivalentModifierMask:NSCommandKeyMask]; + // Avoid Cmd+C closing dialog on Mac. + if (accelstring == "c" && GetWXPeer()->GetId() == wxID_CANCEL) + { + [GetNSButton() setKeyEquivalent:@""]; + } + else + { + wxString cancelLabel(_("&Cancel")); + wxCFStringRef cfText(accelstring); + [GetNSButton() setKeyEquivalent:cfText.AsNSString()]; + [GetNSButton() setKeyEquivalentModifierMask:NSCommandKeyMask]; + } } else {