Zach Gorman <zach@archetypeauction.com>

The initial dialog focus should be established by the default handler
for SetFocus(), not in the dialog creation code.

svn path=/trunk/; revision=11778
This commit is contained in:
Gé van Geldorp 2004-11-22 10:59:01 +00:00
parent 7982beed9e
commit b87b03682a

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dialog.c,v 1.27 2004/08/15 21:36:29 chorns Exp $
/* $Id: dialog.c,v 1.28 2004/11/22 10:59:01 gvg Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/dialog.c
@ -816,33 +816,15 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if (DIALOG_CreateControls32( hwnd, dlgTemplate, &template, hInst, unicode ))
{
HWND hwndPreInitFocus;
/* Send initialisation messages and set focus */
dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
hwndPreInitFocus = GetFocus();
if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
{
/* check where the focus is again,
* some controls status might have changed in WM_INITDIALOG */
/* By returning TRUE, app has requested a default focus assignment */
dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
if( dlgInfo->hwndFocus )
SetFocus( dlgInfo->hwndFocus );
}
else
{
/* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
but the focus has not changed, set the focus where we expect it. */
if ((GetFocus() == hwndPreInitFocus) &&
(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
{
dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
if( dlgInfo->hwndFocus )
SetFocus( dlgInfo->hwndFocus );
}
}
if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
{