Changeset 29

Show
Ignore:
Timestamp:
02/20/08 18:12:15 (7 months ago)
Author:
Chris Miller
Message:

Internal changes; changes to dialog events.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/win32/dfl/control.d

    r26 r29  
    37163716     
    37173717     
    3718     private static bool _eachild(HWND hw, bool delegate(HWND hw) callback, inout size_t xiter
     3718    private static bool _eachild(HWND hw, bool delegate(HWND hw) callback, inout size_t xiter, bool nested
    37193719    { 
    37203720        for(; hw; hw = GetWindow(hw, GW_HWNDNEXT)) 
     
    37333733                return false; 
    37343734             
    3735             //LONG exst = GetWindowLongA(hw, GWL_EXSTYLE); 
    3736             //if(exst & WS_EX_CONTROLPARENT) // It's no longer added. 
    3737             { 
    3738                 HWND hwc = GetWindow(hw, GW_CHILD); 
    3739                 if(hwc) 
    3740                 { 
    3741                     if(!_eachild(hwc, callback, xiter)) 
    3742                         return false; 
     3735            if(nested) 
     3736            { 
     3737                //LONG exst = GetWindowLongA(hw, GWL_EXSTYLE); 
     3738                //if(exst & WS_EX_CONTROLPARENT) // It's no longer added. 
     3739                { 
     3740                    HWND hwc = GetWindow(hw, GW_CHILD); 
     3741                    if(hwc) 
     3742                    { 
     3743                        //if(!_eachild(hwc, callback, xiter, nested)) 
     3744                        if(!_eachild(hwc, callback, xiter, true)) 
     3745                            return false; 
     3746                    } 
    37433747                } 
    37443748            } 
     
    37473751    } 
    37483752     
    3749     package static void eachGoodChildHandle(HWND hwtoplevel, bool delegate(HWND hw) callback
    3750     { 
    3751         HWND hw = GetWindow(hwtoplevel, GW_CHILD); 
     3753    package static void eachGoodChildHandle(HWND hwparent, bool delegate(HWND hw) callback, bool nested = true
     3754    { 
     3755        HWND hw = GetWindow(hwparent, GW_CHILD); 
    37523756        size_t xiter = 2000; 
    3753         _eachild(hw, callback, xiter); 
     3757        _eachild(hw, callback, xiter, nested); 
    37543758    } 
    37553759     
     
    37633767     
    37643768    package static void _dlgselnext(HWND hwdlg, HWND hwcursel, bool forward, 
    3765         bool tabStopOnly = true, bool selectableOnly = false) 
    3766     { 
     3769        bool tabStopOnly = true, bool selectableOnly = false, 
     3770        bool nested = true, bool wrap = true, 
     3771        HWND hwchildrenof = null) 
     3772    { 
     3773        if(!hwchildrenof) 
     3774            hwchildrenof = hwdlg; 
    37673775        if(forward) 
    37683776        { 
    37693777            bool foundthis = false, tdone = false; 
    37703778            HWND hwfirst; 
    3771             eachGoodChildHandle(hwdlg
     3779            eachGoodChildHandle(hwchildrenof
    37723780                (HWND hw) 
    37733781                { 
     
    37983806                    } 
    37993807                    return true; // Continue. 
    3800                 }); 
     3808                }, nested); 
    38013809            if(!tdone && HWND.init != hwfirst) 
    3802                 DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hwfirst, MAKELPARAM(true, 0)); 
     3810            { 
     3811                // If it falls through without finding hwcursel, let it select the first one, even if not wrapping. 
     3812                if(wrap || !foundthis) 
     3813                { 
     3814                    DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hwfirst, MAKELPARAM(true, 0)); 
     3815                } 
     3816            } 
    38033817        } 
    38043818        else 
    38053819        { 
    38063820            HWND hwprev; 
    3807             eachGoodChildHandle(hwdlg
     3821            eachGoodChildHandle(hwchildrenof
    38083822                (HWND hw) 
    38093823                { 
     
    38123826                        if(HWND.init != hwprev) // Otherwise, keep looping and get last one. 
    38133827                            return false; // Break. 
     3828                        if(!wrap) // No wrapping, so don't get last one. 
     3829                        { 
     3830                            assert(HWND.init == hwprev); 
     3831                            return false; // Break. 
     3832                        } 
    38143833                    } 
    38153834                    if(!tabStopOnly || (GetWindowLongA(hw, GWL_STYLE) & WS_TABSTOP)) 
     
    38213840                    } 
    38223841                    return true; // Continue. 
    3823                 }); 
     3842                }, nested); 
     3843            // If it falls through without finding hwcursel, let it select the last one, even if not wrapping. 
    38243844            if(HWND.init != hwprev) 
    38253845                DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hwprev, MAKELPARAM(true, 0)); 
    38263846        } 
     3847    } 
     3848     
     3849     
     3850    package final void _selectNextControl(Control ctrltoplevel, 
     3851        Control ctrl, bool forward, bool tabStopOnly, bool nested, bool wrap) 
     3852    { 
     3853        if(!created) 
     3854            return; 
     3855         
     3856        assert(ctrltoplevel !is null); 
     3857        assert(ctrltoplevel.isHandleCreated); 
     3858         
     3859        _dlgselnext(ctrltoplevel.handle, 
     3860            (ctrl && ctrl.isHandleCreated) ? ctrl.handle : null, 
     3861            forward, tabStopOnly, !tabStopOnly, nested, wrap, 
     3862            this.handle); 
     3863    } 
     3864     
     3865     
     3866    final void selectNextControl(Control ctrl, bool forward, bool tabStopOnly, bool nested, bool wrap) 
     3867    { 
     3868        if(!created) 
     3869            return; 
     3870         
     3871        Control ctrltoplevel; 
     3872        ctrltoplevel = findForm(); 
     3873        if(ctrltoplevel) 
     3874            return _selectNextControl(ctrltoplevel, ctrl, forward, tabStopOnly, nested, wrap); 
    38273875    } 
    38283876     
     
    61306178            wstyle = style; 
    61316179             
    6132             /+ 
     6180            //if((ctrlStyle & ControlStyles.CONTAINER_CONTROL) && (style & WS_CHILD)) 
    61336181            if(style & WS_CHILD) 
    61346182            { 
    6135                 if(exStyle & WS_EX_CONTROLPARENT) 
    6136                     //wstyle = style |= WS_TABSTOP; // Otherwise, Windows could get stuck in an infinite loop ? 
    6137                     wstyle = style |= WS_TABSTOP | WS_GROUP; // ? 
    6138             } 
    6139             +/ 
     6183                exStyle |= WS_EX_CONTROLPARENT; 
     6184            } 
    61406185             
    61416186            Application.creatingControl(this); 
     
    79297974    private void _init() 
    79307975    { 
    7931         wexstyle |= WS_EX_CONTROLPARENT; 
     7976        //wexstyle |= WS_EX_CONTROLPARENT; 
    79327977        ctrlStyle |= ControlStyles.CONTAINER_CONTROL; 
    79337978    } 
  • trunk/win32/dfl/form.d

    r28 r29  
    25112511             
    25122512            case WM_SETFOCUS: 
    2513                 { 
    2514                    // Prevent DefDlgProc from getting this message because it'll focus controls it shouldn't. 
     2513                /+ 
     2514                { 
    25152515                    bool didf = false; 
    25162516                    enumChildWindows(msg.hWnd, 
     
    25302530                        SetFocus(msg.hWnd); 
    25312531                } 
     2532                +/ 
     2533                _selectNextControl(this, null, true, true, true, false); 
     2534                if(!GetFocus()) 
     2535                    focus(); 
     2536                // Prevent DefDlgProc from getting this message because it'll focus controls it shouldn't. 
    25322537                return; 
    25332538             
     
    28262831                        break; 
    28272832                     
    2828                     default: ; 
    2829                 } 
    2830                  
    2831                 /+ 
    2832                 switch(m.msg) 
    2833                 { 
    2834                     case WM_CHAR: 
    2835                         // isDialogMessage seems to be eating WM_CHAR in some cases, so see for myself if it should get it. 
    2836                         // ? ... 
    2837                         return false; // Continue. 
    2838                      
    2839                     /+ 
    2840                     case WM_SYSKEYDOWN: 
    2841                     case WM_SYSKEYUP: 
    2842                     case WM_SYSCHAR: 
    2843                         // isDialogMessage returning true seems to be breaking menu mnemonics. 
    2844                         return false; // Continue. 
    2845                     +/ 
    2846                      
    2847                     default: ; 
    2848                 } 
    2849                  
    2850                 //if(!form.isMdiChild && !form.isMdiContainer) 
    2851                 { 
    2852                     //if(IsDialogMessageA(form.handle, &m._winMsg)) 
    2853                     if(dfl.internal.utf.isDialogMessage(form.handle, &m._winMsg)) 
    2854                         return true; // Prevent. 
    2855                 } 
    2856                 +/ 
    2857                 switch(m.msg) 
    2858                 { 
    28592833                    case WM_SYSCHAR: 
    28602834                        { 
  • trunk/win32/dfl/tabcontrol.d

    r16 r29  
    3838    { 
    3939        Application.ppin(cast(void*)this); 
     40         
     41        ctrlStyle |= ControlStyles.CONTAINER_CONTROL; 
    4042         
    4143        wstyle &= ~WS_VISIBLE;