pressing enter now activates the default button even when the focus is on a checkbox or radio button

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35315 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-08-25 19:27:43 +00:00
parent 8dbb7967d4
commit 3147bb585a

View File

@@ -1975,7 +1975,10 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
// it // it
return false; return false;
} }
else if ( lDlgCode & DLGC_BUTTON )
// currently active button should get enter press even
// if there is a default button elsewhere
if ( lDlgCode & DLGC_DEFPUSHBUTTON )
{ {
// let IsDialogMessage() handle this for all // let IsDialogMessage() handle this for all
// buttons except the owner-drawn ones which it // buttons except the owner-drawn ones which it
@@ -1984,16 +1987,15 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
if ( (style & BS_OWNERDRAW) == BS_OWNERDRAW ) if ( (style & BS_OWNERDRAW) == BS_OWNERDRAW )
{ {
// emulate the button click // emulate the button click
wxWindow *btn = wxFindWinFromHandle((WXHWND)msg->hwnd); wxWindow *
btn = wxFindWinFromHandle((WXHWND)msg->hwnd);
if ( btn ) if ( btn )
btn->MSWCommand(BN_CLICKED, 0 /* unused */); btn->MSWCommand(BN_CLICKED, 0 /* unused */);
} }
bProcess = false; bProcess = false;
} }
// FIXME: this should be handled by else // not a button itself
// wxNavigationKeyEvent handler and not here!
else
{ {
#if wxUSE_BUTTON #if wxUSE_BUTTON
wxButton *btn = wxDynamicCast(GetDefaultItem(), wxButton *btn = wxDynamicCast(GetDefaultItem(),