Changeset 26

Show
Ignore:
Timestamp:
02/20/08 00:27:28 (8 months ago)
Author:
Chris Miller
Message:

More fixes.

Files:

Legend:

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

    r23 r26  
    18211821    void function(Control, size_t[]) fp; 
    18221822    size_t nparams; 
    1823     size_t[0] params; 
     1823    size_t[1] params; 
    18241824} 
    18251825 
  • trunk/win32/dfl/control.d

    r25 r26  
    34863486         
    34873487        DflInvokeParam* p; 
    3488         p = cast(DflInvokeParam*)dfl.internal.clib.malloc(DflInvokeParam.sizeof + params.length * size_t.sizeof); 
     3488        p = cast(DflInvokeParam*)dfl.internal.clib.malloc( 
     3489            (DflInvokeParam.sizeof - size_t.sizeof) 
     3490                + params.length * size_t.sizeof); 
    34893491        if(!p) 
    34903492            throw new OomException(); 
     
    37533755     
    37543756     
    3755     package static void _dlgselnext(HWND hwdlg, HWND hwcursel, bool forward) 
     3757    private static bool _isHwndControlSel(HWND hw) 
     3758    { 
     3759        Control c = Control.fromHandle(hw); 
     3760        return c && c.getStyle(ControlStyles.SELECTABLE); 
     3761    } 
     3762     
     3763     
     3764    package static void _dlgselnext(HWND hwdlg, HWND hwcursel, bool forward, 
     3765        bool tabStopOnly = true, bool selectableOnly = false) 
    37563766    { 
    37573767        if(forward) 
     
    37623772                (HWND hw) 
    37633773                { 
     3774                    assert(!tdone); 
    37643775                    if(hw == hwcursel) 
    37653776                    { 
     
    37683779                    else 
    37693780                    { 
    3770                         LONG st = GetWindowLongA(hw, GWL_STYLE); 
    3771                         if(st & WS_TABSTOP) 
     3781                        if(!tabStopOnly || (GetWindowLongA(hw, GWL_STYLE) & WS_TABSTOP)) 
    37723782                        { 
    3773                             if(foundthis
     3783                            if(!selectableOnly || _isHwndControlSel(hw)
    37743784                            { 
    3775                                 DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hw, MAKELPARAM(true, 0)); 
    3776                                 tdone = true; 
    3777                                 return false; // Break. 
    3778                             } 
    3779                             else 
    3780                             { 
    3781                                 if(HWND.init == hwfirst) 
    3782                                     hwfirst = hw; 
     3785                                if(foundthis) 
     3786                                { 
     3787                                    DefDlgProcA(hwdlg, WM_NEXTDLGCTL, cast(WPARAM)hw, MAKELPARAM(true, 0)); 
     3788                                    tdone = true; 
     3789                                    return false; // Break. 
     3790                                } 
     3791                                else 
     3792                                { 
     3793                                    if(HWND.init == hwfirst) 
     3794                                        hwfirst = hw; 
     3795                                } 
    37833796                            } 
    37843797                        } 
     
    38003813                            return false; // Break. 
    38013814                    } 
    3802                     LONG st = GetWindowLongA(hw, GWL_STYLE); 
    3803                     if(st & WS_TABSTOP) 
    3804                         hwprev = hw; 
     3815                    if(!tabStopOnly || (GetWindowLongA(hw, GWL_STYLE) & WS_TABSTOP)) 
     3816                    { 
     3817                        if(!selectableOnly || _isHwndControlSel(hw)) 
     3818                        { 
     3819                            hwprev = hw; 
     3820                        } 
     3821                    } 
    38053822                    return true; // Continue. 
    38063823                }); 
     
    38223839    // otherwise the previous control in the tab order is selected. 
    38233840    // Controls without style ControlStyles.SELECTABLE are skipped. 
    3824     /+protected+/ void select(bool directed, bool forward) 
     3841    void select(bool directed, bool forward) 
    38253842    { 
    38263843        if(!created) 
     
    38503867            else 
    38513868            { 
    3852                 DefDlgProcA(ctrltoplevel.handle, WM_NEXTDLGCTL, cast(WPARAM)this.handle, MAKELPARAM(true, 0)); 
     3869                if(canSelect) 
     3870                    DefDlgProcA(ctrltoplevel.handle, WM_NEXTDLGCTL, cast(WPARAM)this.handle, MAKELPARAM(true, 0)); 
    38533871            } 
    38543872        } 
  • trunk/win32/dfl/form.d

    r25 r26  
    27452745                            case Keys.UP, Keys.DOWN: 
    27462746                            case Keys.RIGHT, Keys.LEFT: 
    2747                                 if(dfl.internal.utf.isDialogMessage(form.handle, &m._winMsg)) 
    2748                                     return true; // Prevent. 
     2747                                //if(dfl.internal.utf.isDialogMessage(form.handle, &m._winMsg)) // Stopped working after removing controlparent. 
     2748                                //  return true; // Prevent. 
     2749                                { 
     2750                                    LRESULT dlgc; 
     2751                                    dlgc = SendMessageA(m.hWnd, WM_GETDLGCODE, 0, 0); 
     2752                                    if(!(dlgc & (DLGC_WANTALLKEYS | DLGC_WANTARROWS))) 
     2753                                    { 
     2754                                        if(WM_KEYDOWN == m.msg) 
     2755                                        { 
     2756                                            switch(cast(Keys)m.wParam) 
     2757                                            { 
     2758                                                case Keys.UP, Keys.LEFT: 
     2759                                                    // Backwards... 
     2760                                                    Control._dlgselnext(form.handle, m.hWnd, false, false, true); 
     2761                                                    break; 
     2762                                                case Keys.DOWN, Keys.RIGHT: 
     2763                                                    // Forwards... 
     2764                                                    Control._dlgselnext(form.handle, m.hWnd, true, false, true); 
     2765                                                    break; 
     2766                                                default: 
     2767                                                    assert(0); 
     2768                                            } 
     2769                                        } 
     2770                                        return true; // Prevent. 
     2771                                    } 
     2772                                } 
    27492773                                return false; // Continue. 
    27502774