I found and fixed 2 problems in DEAFULTPUSHBUTTON management: 1) In function DIALOG_CreateControls32 if a default push button exists the dlgInfo->idResult is set with the DefPushButtonId. If I change the focus to other controls of the dialog with the TAB key, each time I change the focus the function DEFDLG_SetDefButton is called (and that is correct) and the dlgInfo->idResult is set with the new control id also if it is NOT a button (i.e. "edit control"). As a result, pressing the 'Enter'key, nothing happens. I reviewed the code and changed the following: 1. added a member in the DIALOGINFO structure (int OriDefButID) where the original default button ID is stored. 2. modified the DEFDG_SetDefButton function (windows/defdlg.c). 2) Pressing the Enter key in a Dialog without a default push-button, a wrong button ID is returned (always '1'). I modifiied the code (DIALOG_CreateControls32 function in ./windows/dialog.c), so that at least an existing button-ID is stored as a default. NB: I can't use CVS (for a login problem) -- Katia Maculan Developer ISIS Papyrus Italy Srl Tel: (+39) 0125 6455400 Fax: (+39) 0125 6455150 E-mail: katia.maculan(a)isis-papyrus.com Info: info(a)isis-papyrus.com Hotline: +43-2236-27551-111 Visit our Website: http://www.isis-papyrus.com diff -urN oldwinedir/dlls/user/controls.h newwinedir/dlls/user/controls.h --- oldwinedir/dlls/user/controls.h 2004-03-04 02:41:11.000000000 +0100 +++ newwinedir/dlls/user/controls.h 2004-07-15 14:05:44.000000000 +0200 @@ -126,6 +126,7 @@ INT idResult; /* EndDialog() result / default pushbutton ID */ UINT flags; /* EndDialog() called for this dialog */ HGLOBAL16 hDialogHeap; + INT OriDefButID; /* the original DEFPUSHBUTTON */ } DIALOGINFO; #define DF_END 0x0001 diff -urN oldwinedir/windows/defdlg.c newwinedir/windows/defdlg.c --- oldwinedir/windows/defdlg.c 2004-04-20 06:02:35.000000000 +0200 +++ newwinedir/windows/defdlg.c 2004-07-15 14:07:12.000000000 +0200 @@ -135,13 +135,27 @@ { DWORD dlgcode=0; /* initialize just to avoid a warning */ HWND hwndNew = GetDlgItem(hwndDlg, wParam); - - dlgInfo->idResult = wParam; + //more tests are necessary before save that id like a defpushbutton dlgInfo->idResult = wParam; if (hwndNew && !((dlgcode=SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 )) & (DLGC_UNDEFPUSHBUTTON | DLGC_BUTTON))) + { + //if destination is not a push button the original def push button is set like default + if (dlgInfo->idResult) + { + HWND hwndOld = GetDlgItem( hwndDlg, dlgInfo->idResult ); + if (hwndOld && (SendMessageA( hwndOld, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)) + SendMessageA( hwndOld, BM_SETSTYLE, BS_PUSHBUTTON, TRUE ); + } + dlgInfo->idResult = dlgInfo->OriDefButID; + hwndNew = GetDlgItem (hwndDlg, dlgInfo->OriDefButID); + if (hwndNew) + SendMessageA( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE ); return FALSE; /* Destination is not a push button */ + } + if (dlgInfo->idResult == wParam) //if new defbutton is the actual nothing change + return TRUE; if (dlgInfo->idResult) /* There's already a default pushbutton */ { HWND hwndOld = GetDlgItem( hwndDlg, dlgInfo->idResult ); @@ -150,8 +164,11 @@ } if (hwndNew) { - if(dlgcode==DLGC_UNDEFPUSHBUTTON) + if(dlgcode & DLGC_UNDEFPUSHBUTTON) //it is DLGC_UNDEFBUTTON && DLGC_BUTTON + { SendMessageA( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE ); + dlgInfo->idResult = wParam; // now is correct to save the new def push button + } } return TRUE; } diff -urN oldwinedir/windows/dialog.c newwinedir/windows/dialog.c --- oldwinedir/windows/dialog.c 2004-05-18 22:45:22.000000000 +0200 +++ newwinedir/windows/dialog.c 2004-07-15 14:07:05.000000000 +0200 @@ -292,6 +292,7 @@ DLG_CONTROL_INFO info; HWND hwndCtrl, hwndDefButton = 0; INT items = dlgTemplate->nbItems; + DWORD dlgcode=0; //to have the control information TRACE(" BEGIN\n" ); while (items--) @@ -353,7 +354,8 @@ /* Send initialisation messages to the control */ if (dlgInfo->hUserFont) SendMessageA( hwndCtrl, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 ); - if (SendMessageA(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON) + dlgcode = SendMessageA(hwndCtrl, WM_GETDLGCODE, 0, 0); //save the result for future test + if (dlgcode & DLGC_DEFPUSHBUTTON) { /* If there's already a default push-button, set it back */ /* to normal and use this one instead. */ @@ -361,7 +363,21 @@ SendMessageA( hwndDefButton, BM_SETSTYLE, BS_PUSHBUTTON, FALSE ); hwndDefButton = hwndCtrl; dlgInfo->idResult = GetWindowLongA( hwndCtrl, GWL_ID ); + dlgInfo->OriDefButID = dlgInfo->idResult; //save the ID like the original DEFPUSHBUTTON } + else + { + // if no defpushbutton is found and the control is a normal pushbutton + // this button is set like defpushbutton + if ((dlgInfo->idResult == 0) && (dlgcode & DLGC_UNDEFPUSHBUTTON)) + { + hwndDefButton = hwndCtrl; + dlgInfo->idResult = GetWindowLongA( hwndCtrl, GWL_ID ); + dlgInfo->OriDefButID = dlgInfo->idResult; + SendMessageA( hwndDefButton, BM_SETSTYLE, BS_DEFPUSHBUTTON, FALSE ); + } + + } } TRACE(" END\n" ); return TRUE;
Hello, On Thu, Jul 15, 2004 at 03:38:38PM +0200, Katia Maculan wrote:
I found and fixed 2 problems in DEAFULTPUSHBUTTON management:
Since the destination address was titled "path", I assume you intend(ed) to send it to wine-patches instead. Unless you're not sure yet and thus want to have it thoroughly discussed on wine-devel first, in which case it would not get applied immediately, since it didn't appear on wine-patches. Thanks! Andreas Mohr
Sorry I used the wrong address. Thanks Katia Andreas Mohr wrote:
Hello,
On Thu, Jul 15, 2004 at 03:38:38PM +0200, Katia Maculan wrote:
I found and fixed 2 problems in DEAFULTPUSHBUTTON management:
Since the destination address was titled "path", I assume you intend(ed) to send it to wine-patches instead. Unless you're not sure yet and thus want to have it thoroughly discussed on wine-devel first, in which case it would not get applied immediately, since it didn't appear on wine-patches.
Thanks!
Andreas Mohr
-- Katia Maculan Developer ISIS Papyrus Italy Srl Tel: (+39) 0125 6455400 Fax: (+39) 0125 6455150 E-mail: katia.maculan(a)isis-papyrus.com Info: info(a)isis-papyrus.com Hotline: +43-2236-27551-111 Visit our Website: http://www.isis-papyrus.com
participants (2)
-
Andreas Mohr -
Katia Maculan