Ignore:
Timestamp:
Nov 20, 2001, 4:25:18 PM (24 years ago)
Author:
sandervl
Message:

dialog focus fix: don't set focus to dialog child if the dialog has a parent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/win32dlg.cpp

    r7325 r7404  
    1 /* $Id: win32dlg.cpp,v 1.74 2001-11-12 18:01:05 sandervl Exp $ */
     1/* $Id: win32dlg.cpp,v 1.75 2001-11-20 15:25:18 sandervl Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    263263        if(SendInternalMessageA(WM_INITDIALOG, (WPARAM)hwndFocus, param))
    264264        {
    265             /* check where the focus is again,
    266              * some controls status might have changed in WM_INITDIALOG */
    267             hwndFocus = GetNextDlgTabItem( getWindowHandle(), 0, FALSE );
    268             if(GetFocus() != hwndFocus) {
    269                 SetFocus(hwndFocus);
     265            //SvL: Experiments in NT4 show that dialogs that are children don't
     266            //     receive focus. Not sure if this is always true. (couldn't
     267            //     find any remarks about this in the SDK docs)
     268            if(!(getStyle() & WS_CHILD))
     269            {
     270                /* check where the focus is again,
     271                 * some controls status might have changed in WM_INITDIALOG */
     272                hwndFocus = GetNextDlgTabItem( getWindowHandle(), 0, FALSE );
     273                if(GetFocus() != hwndFocus) {
     274                    SetFocus(hwndFocus);
     275                }
    270276            }
    271277        }
    272278        else
    273279        {
    274             /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
    275                but the focus has not changed, set the focus where we expect it. */
    276             if ( (getStyle() & WS_VISIBLE) && ( GetFocus() == hwndPreInitFocus ) )
    277                 SetFocus( hwndFocus );
     280            //SvL: Experiments in NT4 show that dialogs that are children don't
     281            //     receive focus. Not sure if this is always true. (couldn't
     282            //     find any remarks about this in the SDK docs)
     283            if(!(getStyle() & WS_CHILD))
     284            {
     285                /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
     286                   but the focus has not changed, set the focus where we expect it. */
     287                if ( (getStyle() & WS_VISIBLE) && ( GetFocus() == hwndPreInitFocus ) )
     288                    SetFocus( hwndFocus );
     289            }
    278290        }
    279291
Note: See TracChangeset for help on using the changeset viewer.