don't use char hook to handle Esc in the dialogs, it is too blunt and prevents us from using it for the other purposes such as closing popup menus (bug 884713)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25649 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-02-08 16:20:02 +00:00
parent 014249a8f0
commit 16dd61ac10
3 changed files with 21 additions and 33 deletions

View File

@@ -113,8 +113,6 @@ BEGIN_EVENT_TABLE(wxDialog, wxDialogBase)
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
EVT_CHAR_HOOK(wxDialog::OnCharHook)
EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
EVT_CLOSE(wxDialog::OnCloseWindow)
@@ -214,35 +212,6 @@ wxDialog::~wxDialog()
Show(FALSE);
}
// ----------------------------------------------------------------------------
// kbd handling
// ----------------------------------------------------------------------------
// By default, pressing escape cancels the dialog
void wxDialog::OnCharHook(wxKeyEvent& event)
{
if (GetHWND())
{
// "Esc" works as an accelerator for the "Cancel" button, but it
// shouldn't close the dialog which doesn't have any cancel button
if ( (event.m_keyCode == WXK_ESCAPE) && FindWindow(wxID_CANCEL) )
{
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent);
// ensure that there is another message for this window so the
// ShowModal loop will exit and won't get stuck in GetMessage().
::PostMessage(GetHwnd(), WM_NULL, 0, 0);
return;
}
}
// We didn't process this event.
event.Skip();
}
// ----------------------------------------------------------------------------
// showing the dialogs
// ----------------------------------------------------------------------------