Joachim Priesner : user32: msgbox: Make buttons an own control group.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Oct 14 11:12:51 CDT 2015


Module: wine
Branch: master
Commit: 217fe9cfad062912c3a824f3d24e444788ade3c1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=217fe9cfad062912c3a824f3d24e444788ade3c1

Author: Joachim Priesner <joachim.priesner at web.de>
Date:   Mon Oct 12 16:57:49 2015 +0200

user32: msgbox: Make buttons an own control group.

Signed-off-by: Joachim Priesner <joachim.priesner at web.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/msgbox.c  | 11 ++++++++++-
 dlls/user32/user32.rc |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/msgbox.c b/dlls/user32/msgbox.c
index 7fb17bd..00f2bd9 100644
--- a/dlls/user32/msgbox.c
+++ b/dlls/user32/msgbox.c
@@ -115,12 +115,14 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
     TRACE_(msgbox)("%s\n", debugstr_w(lpszText));
     SetWindowTextW(GetDlgItem(hwnd, MSGBOX_IDTEXT), lpszText);
 
-    /* Remove not selected buttons */
+    /* Remove not selected buttons and assign the WS_GROUP style to the first button */
+    hItem = 0;
     switch(lpmb->dwStyle & MB_TYPEMASK) {
     case MB_OK:
 	DestroyWindow(GetDlgItem(hwnd, IDCANCEL));
 	/* fall through */
     case MB_OKCANCEL:
+	hItem = GetDlgItem(hwnd, IDOK);
 	DestroyWindow(GetDlgItem(hwnd, IDABORT));
 	DestroyWindow(GetDlgItem(hwnd, IDRETRY));
 	DestroyWindow(GetDlgItem(hwnd, IDIGNORE));
@@ -130,6 +132,7 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
 	DestroyWindow(GetDlgItem(hwnd, IDCONTINUE));
 	break;
     case MB_ABORTRETRYIGNORE:
+	hItem = GetDlgItem(hwnd, IDABORT);
 	DestroyWindow(GetDlgItem(hwnd, IDOK));
 	DestroyWindow(GetDlgItem(hwnd, IDCANCEL));
 	DestroyWindow(GetDlgItem(hwnd, IDYES));
@@ -141,6 +144,7 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
 	DestroyWindow(GetDlgItem(hwnd, IDCANCEL));
 	/* fall through */
     case MB_YESNOCANCEL:
+	hItem = GetDlgItem(hwnd, IDYES);
 	DestroyWindow(GetDlgItem(hwnd, IDOK));
 	DestroyWindow(GetDlgItem(hwnd, IDABORT));
 	DestroyWindow(GetDlgItem(hwnd, IDRETRY));
@@ -149,6 +153,7 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
 	DestroyWindow(GetDlgItem(hwnd, IDTRYAGAIN));
 	break;
     case MB_RETRYCANCEL:
+	hItem = GetDlgItem(hwnd, IDRETRY);
 	DestroyWindow(GetDlgItem(hwnd, IDOK));
 	DestroyWindow(GetDlgItem(hwnd, IDABORT));
 	DestroyWindow(GetDlgItem(hwnd, IDIGNORE));
@@ -158,6 +163,7 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
 	DestroyWindow(GetDlgItem(hwnd, IDTRYAGAIN));
 	break;
     case MB_CANCELTRYCONTINUE:
+	hItem = GetDlgItem(hwnd, IDCANCEL);
 	DestroyWindow(GetDlgItem(hwnd, IDOK));
 	DestroyWindow(GetDlgItem(hwnd, IDABORT));
 	DestroyWindow(GetDlgItem(hwnd, IDIGNORE));
@@ -165,6 +171,9 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
 	DestroyWindow(GetDlgItem(hwnd, IDNO));
 	DestroyWindow(GetDlgItem(hwnd, IDRETRY));
     }
+
+    if (hItem) SetWindowLongW(hItem, GWL_STYLE, GetWindowLongW(hItem, GWL_STYLE) | WS_GROUP);
+
     /* Set the icon */
     switch(lpmb->dwStyle & MB_ICONMASK) {
     case MB_ICONEXCLAMATION:
diff --git a/dlls/user32/user32.rc b/dlls/user32/user32.rc
index d281d53..5c67585 100644
--- a/dlls/user32/user32.rc
+++ b/dlls/user32/user32.rc
@@ -75,7 +75,6 @@ MSGBOX DIALOG 100, 80, 216, 168
 STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 BEGIN
     ICON "", MSGBOX_IDICON, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
-    LTEXT "", MSGBOX_IDTEXT, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP | SS_NOPREFIX
     PUSHBUTTON "OK", IDOK, 16, 56, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "Cancel", IDCANCEL, 74, 56, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Abort", IDABORT, 132, 56, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
@@ -86,6 +85,7 @@ BEGIN
     PUSHBUTTON "&Try Again", IDTRYAGAIN, 422, 56, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Continue", IDCONTINUE, 480, 56, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "Help", IDHELP, 538, 56, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    LTEXT "", MSGBOX_IDTEXT, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP | SS_NOPREFIX
 END
 
 MDI_MOREWINDOWS DIALOG 20, 20, 232, 122




More information about the wine-cvs mailing list