From 70cd8cb4aea84da31cf117f39486bd2fd3898326 Mon Sep 17 00:00:00 2001 From: Luc Tourangeau <luc@macadamian.com> Date: Sat, 10 Jul 1999 11:57:29 +0000 Subject: [PATCH] Added BN_CLICKED notification in WM_SETFOCUS. --- controls/button.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/controls/button.c b/controls/button.c index aa8f0f72bed..12937b93f16 100644 --- a/controls/button.c +++ b/controls/button.c @@ -138,8 +138,8 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg, case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: SendMessageA( hWnd, BM_SETSTATE, TRUE, 0 ); - SetFocus( hWnd ); SetCapture( hWnd ); + SetFocus( hWnd ); break; case WM_LBUTTONUP: @@ -199,9 +199,16 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg, return infoPtr->hFont; case WM_SETFOCUS: + if ((style == BS_AUTORADIOBUTTON) && (GetCapture() != hWnd) && + !(SendMessageA(hWnd, BM_GETCHECK, 0, 0) & BST_CHECKED)) + { + /* The notification is sent when the button (BS_AUTORADIOBUTTON) + is unckecked and the focus was not given by a mouse click. */ + SendMessageA( hWnd, BM_SETCHECK, TRUE, 0 ); + SendMessageA( GetParent(hWnd), WM_COMMAND, + MAKEWPARAM( wndPtr->wIDmenu, BN_CLICKED ), hWnd); + } infoPtr->state |= BUTTON_HASFOCUS; - if (style == BS_AUTORADIOBUTTON) - SendMessageA( hWnd, BM_SETCHECK, 1, 0 ); PAINT_BUTTON( wndPtr, style, ODA_FOCUS ); break; -- GitLab