Set focus to the dialog in EndDialog.

This commit is contained in:
Abey George 1999-08-07 14:10:04 +00:00 committed by Alexandre Julliard
parent acc19d320b
commit 15c58c4239
2 changed files with 15 additions and 1 deletions

View File

@ -53,7 +53,11 @@ static BOOL DEFDLG_RestoreFocus( HWND hwnd, DIALOGINFO *infoPtr )
{
if (!infoPtr->hwndFocus || IsIconic(hwnd)) return FALSE;
if (!IsWindow( infoPtr->hwndFocus )) return FALSE;
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
/* Don't set the focus back to controls if EndDialog is already called.*/
if (!(infoPtr->flags & DF_END))
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
/* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
sometimes losing focus when receiving WM_SETFOCUS messages. */
return TRUE;

View File

@ -1073,6 +1073,11 @@ BOOL WINAPI EndDialog( HWND hwnd, INT retval )
dlgInfo->flags |= DF_END;
}
/* Windows sets the focus to the dialog itself first in EndDialog */
if (IsChild(hwnd, GetFocus()))
SetFocus(wndPtr->hwndSelf);
/* Paint Shop Pro 4.14 calls EndDialog for a CreateDialog* dialog,
* which isn't "normal". Only DialogBox* dialogs may be EndDialog()ed.
* Just hide the window
@ -1163,6 +1168,7 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0);
}
RetVal = TRUE;
WIN_ReleaseWndPtr(wndPtr);
break;
}
}
@ -1182,6 +1188,10 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
hwndControl = GetParent( hwndControl );
if (hwndControl == hwndDlg)
{
if(hwnd==hwndDlg){ /* prevent endless loop */
hwndNext=hwnd;
break;
}
hwndNext = GetWindow( hwndDlg, GW_CHILD );
}
else