Ignore:
Timestamp:
Feb 17, 2001, 3:49:26 PM (25 years ago)
Author:
sandervl
Message:

activate, tab and ischild bugfixes

File:
1 edited

Legend:

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

    r5065 r5146  
    1 /* $Id: windlg.cpp,v 1.20 2001-02-05 18:49:30 sandervl Exp $ */
     1/* $Id: windlg.cpp,v 1.21 2001-02-17 14:49:26 sandervl Exp $ */
    22/*
    33 * Win32 dialog apis for OS/2
     
    241241    return (BOOL)SendDlgItemMessageA(hwnd, id,BM_GETCHECK,0,0);
    242242}
     243/***********************************************************************
     244 *           DIALOG_GetNextTabItem
     245 *
     246 * Helper for GetNextDlgTabItem
     247 */
     248static HWND DIALOG_GetNextTabItem( HWND hwndMain, HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious )
     249{
     250    LONG dsStyle;
     251    LONG exStyle;
     252    UINT wndSearch = fPrevious ? GW_HWNDPREV : GW_HWNDNEXT;
     253    HWND retWnd = 0;
     254    HWND hChildFirst = 0;
     255
     256    if(!hwndCtrl)
     257    {
     258        hChildFirst = GetWindow(hwndDlg,GW_CHILD);
     259        if(fPrevious) hChildFirst = GetWindow(hChildFirst,GW_HWNDLAST);
     260    }
     261    else
     262    {
     263        HWND hParent = GetParent(hwndCtrl);
     264        BOOL bValid = FALSE;
     265        while( hParent)
     266        {
     267            if(hParent == hwndMain)
     268            {
     269                bValid = TRUE;
     270                break;
     271            }
     272            hParent = GetParent(hParent);
     273        }
     274        if(bValid)
     275        {
     276            hChildFirst = GetWindow(hwndCtrl,wndSearch);
     277            if(!hChildFirst)
     278            {
     279                if(GetParent(hwndCtrl) != hwndMain)
     280                    hChildFirst = GetWindow(GetParent(hwndCtrl),wndSearch);
     281                else
     282                {
     283                    if(fPrevious)
     284                        hChildFirst = GetWindow(hwndCtrl,GW_HWNDLAST);
     285                    else
     286                        hChildFirst = GetWindow(hwndCtrl,GW_HWNDFIRST);
     287                }
     288            }
     289        }       
     290    }
     291    while(hChildFirst)
     292    {
     293        BOOL bCtrl = FALSE;
     294        while(hChildFirst)
     295        {
     296            dsStyle = GetWindowLongA(hChildFirst,GWL_STYLE);
     297            exStyle = GetWindowLongA(hChildFirst,GWL_EXSTYLE);
     298            if( (dsStyle & DS_CONTROL || exStyle & WS_EX_CONTROLPARENT) && (dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED))
     299            {
     300                bCtrl=TRUE;
     301                break;
     302            }
     303            else if( (dsStyle & WS_TABSTOP) && (dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED))
     304                break;
     305            hChildFirst = GetWindow(hChildFirst,wndSearch);
     306        }
     307        if(hChildFirst)
     308        {
     309            if(bCtrl)
     310                retWnd = DIALOG_GetNextTabItem(hwndMain,hChildFirst,(HWND)NULL,fPrevious );
     311            else
     312                retWnd = hChildFirst;
     313        }
     314        if(retWnd) break;
     315        hChildFirst = GetWindow(hChildFirst,wndSearch);
     316    }
     317    if(!retWnd && hwndCtrl)
     318    {
     319        HWND hParent = GetParent(hwndCtrl);
     320        while(hParent)
     321        {
     322            if(hParent == hwndMain) break;
     323            retWnd = DIALOG_GetNextTabItem(hwndMain,GetParent(hParent),hParent,fPrevious );
     324            if(retWnd) break;
     325            hParent = GetParent(hParent);
     326        }
     327        if(!retWnd)
     328            retWnd = DIALOG_GetNextTabItem(hwndMain,hwndMain,(HWND)NULL,fPrevious );
     329    }
     330    return retWnd;
     331}
    243332//******************************************************************************
    244333//******************************************************************************
     
    253342        return 0;
    254343    }
    255     dprintf(("USER32:  GetNextDlgTabItem\n"));
    256     return window->getNextDlgTabItem(hwndCtrl, fPrevious);
     344    dprintf(("USER32: GetNextDlgTabItem %x %x %d", hwndDlg,hwndCtrl,fPrevious));
     345    return DIALOG_GetNextTabItem(hwndDlg,hwndDlg,hwndCtrl,fPrevious);
    257346}
    258347//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.