Show
Ignore:
Timestamp:
11/03/08 15:58:40 (2 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Merge changes SWT 3.4.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/widgets/ProgressBar.d

    r246 r320  
    341341    /* 
    342342    * Feature in Vista.  When the progress bar is not in 
    343     * a normal state, PBM_SETPOS does not set the position. 
     343    * a normal state, PBM_SETPOS does not set the position 
     344    * of the bar when the selection is equal to the minimum. 
    344345    * This is undocumented.  The fix is to temporarily 
    345346    * set the state to PBST_NORMAL, set the position, then 
     
    347348    */ 
    348349    int /*long*/ state = 0; 
     350    bool fixSelection = false; 
    349351    if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { 
    350         state = OS.SendMessage (handle, OS.PBM_GETSTATE, 0, 0); 
    351         OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_NORMAL, 0); 
     352        int /*long*/ minumum = OS.SendMessage (handle, OS.PBM_GETRANGE, 1, 0); 
     353        int /*long*/ selection = OS.SendMessage (handle, OS.PBM_GETPOS, 0, 0); 
     354        if (selection is minumum) { 
     355            fixSelection = true; 
     356            state = OS.SendMessage (handle, OS.PBM_GETSTATE, 0, 0); 
     357            OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_NORMAL, 0); 
     358        } 
    352359    } 
    353360    OS.SendMessage (handle, OS.PBM_SETPOS, value, 0); 
    354361    if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { 
    355         OS.SendMessage (handle, OS.PBM_SETSTATE, state, 0); 
     362        if (fixSelection) OS.SendMessage (handle, OS.PBM_SETSTATE, state, 0); 
    356363    } 
    357364}