Changeset 36

Show
Ignore:
Timestamp:
02/26/08 05:33:56 (6 months ago)
Author:
Chris Miller
Message:

Fixed context-help issue (helpRequested).
Fixed focus issue when restoring form (from minimize).

Files:

Legend:

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

    r34 r36  
    348348                { 
    349349                    // Fixing the thick border of a default button when enabling and disabling it. 
     350                     
     351                    // To-do: check if correct implementation. 
    350352                     
    351353                    DWORD bst; 
  • trunk/win32/dfl/control.d

    r34 r36  
    979979        } 
    980980        +/ 
     981        assert(getStyle(ControlStyles.CONTAINER_CONTROL), "Control added to non-container parent"); 
    981982         
    982983        onControlAdded(cea); 
     
    62086209            wstyle = style; 
    62096210             
    6210             //if((ctrlStyle & ControlStyles.CONTAINER_CONTROL) && (style & WS_CHILD)) 
    6211             if(style & WS_CHILD
     6211            //if(style & WS_CHILD) // Breaks context-help. 
     6212            if((ctrlStyle & ControlStyles.CONTAINER_CONTROL) && (style & WS_CHILD)
    62126213            { 
    62136214                exStyle |= WS_EX_CONTROLPARENT; 
  • trunk/win32/dfl/form.d

    r35 r36  
    25202520     
    25212521     
    2522     package HWND _lastSel; // Last selected, excluding accept button! 
     2522    package HWND _lastSelBtn; // Last selected button (not necessarily focused), excluding accept button! 
     2523    package HWND _lastSel; // Last senected and focused control. 
    25232524    package HWND _hadfocus; // Before being deactivated. 
    25242525     
     
    25282529    { 
    25292530        bool wasselbtn = false; 
    2530         if(_lastSel
     2531        if(_lastSelBtn
    25312532        { 
    25322533            wasselbtn = true; 
    2533             if(IsChild(this.hwnd, _lastSel)) 
    2534             { 
    2535                 auto lastctrl = Control.fromHandle(_lastSel); 
     2534            if(IsChild(this.hwnd, _lastSelBtn)) 
     2535            { 
     2536                auto lastctrl = Control.fromHandle(_lastSelBtn); 
    25362537                if(lastctrl) 
    25372538                { 
     
    25452546    } 
    25462547     
     2548    package final void _selafter(Control ctrl, bool wasselbtn) 
     2549    { 
     2550        _lastSelBtn = _lastSelBtn.init; 
     2551        auto ibc = cast(IButtonControl)ctrl; 
     2552        if(ibc) 
     2553        { 
     2554            if(acceptButton) 
     2555            { 
     2556                if(ibc !is acceptButton) 
     2557                { 
     2558                    acceptButton.notifyDefault(false); 
     2559                    _lastSelBtn = ctrl.hwnd; 
     2560                } 
     2561                //else don't set _lastSelBtn to accept button. 
     2562            } 
     2563            else 
     2564            { 
     2565                _lastSelBtn = ctrl.hwnd; 
     2566            } 
     2567             
     2568            ibc.notifyDefault(true); 
     2569        } 
     2570        else 
     2571        { 
     2572            if(wasselbtn) // Only do it if there was a different button; don't keep doing this. 
     2573            { 
     2574                if(acceptButton) 
     2575                    acceptButton.notifyDefault(true); 
     2576            } 
     2577        } 
     2578    } 
     2579     
    25472580    package final void _seldeactivate() 
    25482581    { 
     
    25522585                acceptButton.notifyDefault(false); 
    25532586        } 
    2554         _lastSel = GetFocus(); 
    2555     } 
    2556      
    2557     package final void _selafter(Control ctrl, bool wasselbtn) 
    2558     { 
    2559         _lastSel = _lastSel.init; 
    2560         auto ibc = cast(IButtonControl)ctrl; 
    2561         if(ibc) 
    2562         { 
    2563             if(acceptButton) 
    2564             { 
    2565                 if(ibc !is acceptButton) 
    2566                 { 
    2567                     acceptButton.notifyDefault(false); 
    2568                     _lastSel = ctrl.hwnd; 
    2569                 } 
    2570                 //else don't set _lastSel to accept button. 
    2571             } 
    2572             else 
    2573             { 
    2574                 _lastSel = ctrl.hwnd; 
    2575             } 
    2576              
    2577             ibc.notifyDefault(true); 
    2578         } 
    2579         else 
    2580         { 
    2581             if(wasselbtn) // Only do it if there was a different button; don't keep doing this. 
    2582             { 
    2583                 if(acceptButton) 
    2584                     acceptButton.notifyDefault(true); 
    2585             } 
    2586         } 
     2587        //_lastSel = GetFocus(); // Not reliable, especially when minimizing. 
    25872588    } 
    25882589     
     
    26252626             
    26262627            _selafter(ctrl, wasselbtn); 
     2628             
     2629            _lastSel = ctrl.hwnd; 
    26272630        } 
    26282631    }