AutoHotkey Community

It is currently May 27th, 2012, 12:21 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: [stdlib] SB_SetProgress
PostPosted: November 14th, 2008, 9:23 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
Here is a full synopsis:

Help on SB_SetProgress wrote:

    SB_SetProgress
    ___________________________________________________________________

    Creates and controls a progressbar placed atop the last known AHK Gui's Statusbar control.

    SB_SetProgress([param1 [, segment [, options]]])

Parameters wrote:
Param1
Needs to be a number in the given range of the progressbar, its bar's position is changed to that value.
The default range can be changed with the method described below. By default it is from 0 to 100.

Segment
Specify the segment you wish to attach the Progressbar to. If you want only to change it's appearance with the options, and no segments are defined, use 1 which is also the default value.

Options
A string of zero or more options from the list further below.


    ___________________________________________________________________

    Usable Options

    +/-Smooth: Displays a length of segments rather than a smooth continuous bar. Specifying -Smooth is also one of the requirements to show a themed progress bar on Windows XP or later. The other requirement is that the bar not have any custom colors; that is, that the C and Background options be omitted. Windows 95 and NT4 require Internet Explorer 3.0 or later to support this option.

    +/-Range: Sets the range to be something other than 0 to 100. After the word Range, specify the minimum, a dash, and maximum. For example, Range0-1000 would allow a numbers between 0 and 1000; Range-50-50 would allow numbers between -50 and 50; and Range-10--5 would allow numbers between -10 and -5. On Windows 95 and NT4, negative ranges and ranges beyond 65535 will not behave correctly unless Internet Explorer 3.0 or later is installed.
    Using -Range (minus range) will reset the range to standard defaults.

    Cn: Changes the bar's color. Specify for n one of the 16 primary HTML color names or a 6-digit RGB color value. Examples: cRed, cFFFF33, cDefault. If the C option is never used (or cDefault is specified), the system's default bar color will be used.

    BackgroundN: Changes the bar's background color. Specify for n one of the 16 primary HTML color names or a 6-digit RGB color value. Examples: BackgroundGreen, BackgroundFFFF33, BackgroundDefault. If the Background option is never used (or BackgroundDefault is specified), the background color will be that of the window or tab control behind it.

    Enable: Enables a control if it was previously disabled. On by default.

    Disable: Disables or "grays out" a control.

    Show: Shows a control if it was previously hidden.

    Hide: Hides the progressbar control.

    ___________________________________________________________________

    ErrorLevel

    In case an error happens, The ErrorLevel will contain informations about what went wrong. All Descriptions start with the word "FAIL:" written in caps. Possible contents and a brief explanation:

    No StatusBar Control
    Obvious.

    Wrong Segment Parameter
    Will be set when Segment parameter is smaller or equal zero.

    Wrong Segment Count
    Will be set when higher Segment number is given than actual segements exist. Exception: When operating with just a standard statusbarcontrol and no segments at all, a given Segment parameter can be used to have more than just one Progressbar of which only the latest according to its z-Order will be displayed.

    Segmentdimensions
    The function was unable to determine given Segment's dimensions (x/y of upper left corner and x/y of lower right corner)

    On success the ErrorLevel will contain 1

    ___________________________________________________________________

    Returnvalue

    When an Error of the pervious described occurs, the returnvalue will be set to -1. On success to the progressbar's WindowHandle (hWnd).
    ___________________________________________________________________

    Performance

    Allthough it works, it is better not to supply options directly at a loop which will permanently update the statusbar. This may result in flickering of the progressbar due to parsing all comments on each run. Better is to use Seperate commands, and have just passed Param1 and Segemt to update the progressbar. See the example below how to use this properly.

    ___________________________________________________________________

    Remarks

    Currently the so called marqueestyle (that is no given size, but a contantly moving part of the bar) is not functional.
    The -Smooth/+Smooth parameter will only be evaluated upon Progressbar creation and cannot be changed from within the function lateron.

    Using the PBM_DELTAPOS message to increment the Bar by a given step and not by an absolute number is not implemented yet.
    So something comparable to
    Code:
    GuiControl,, MyProgress, +20  ; Increase the current position by 20.

    won't work at the moment.

    To get the current's Progressbar value (if ever needed) a SendMessage must be used like this:
    Code:
    hwnd := SB_SetProgress(50,3,"BackgroundYellow cBlue") ; This is the way to obtain the handle to the control
    SendMessage, PBM_GETPOS:=0x408, wParam:=0, lParam:=0,,ahk_id %hWnd% ; wParam, and lParam needs to be zero in this case
    MsgBox %ErrorLevel% ; The ErrorLevel contains the current position

    ___________________________________________________________________

    Related

    StatusBar, Progress, Styles

    ___________________________________________________________________

    Resources

    Progress Bar Control Reference > Messages
    http://msdn.microsoft.com/en-us/library/cc656531(VS.85).aspx

    [ahksushi] Statusbar with Progressbar and animated Icon
    http://www.autohotkey.com/forum/viewtopic.php?t=37674

    [Solved] How to send an array with SendMessage
    http://www.autohotkey.com/forum/topic6017.html

    [tutorial] Creating windows without GUI commands
    http://www.autohotkey.com/forum/viewtopic.php?t=22904

    ___________________________________________________________________

    Examples

    Code:
    SB_SetProgress(10) ; will create a progress onto entire statusbar showing 10% bar


    A little working example:

    Code:
    Gui,add,text,w280 center,Some text for the gui!
    Gui,add,statusbar
    Gui,show,w300,Statusbar with Progress

    SB_SetParts(20,200,100) ; Make 3 different parts
    SB_SetText("demotext",2) ; Set a text segment 2
    SB_SetIcon(A_AhkPath,1,1) ; Set an Icon to 1st segment
    ; create a 50% progressbar with yellow background and blue bar
    hwnd := SB_SetProgress(50,3,"BackgroundYellow cBlue")
    return


    This example shows advanced features of the SB_SetProgress function

    Code:
    ; ahk-Sushi: Anime Icon + Progressbar in Statusbar
    ; (w) Nov 2008 by DerRaphael(at)oleco.net
    ; modified for SB_SetProgress demonstration

    gui,add,text,w180 center y10,Demo anime Icon`n+ Progressbar in StatusbarControl
    gui,add,button,x+10 yp-3 w90 gRestart vBtn1 default, Restart!
    Gui,add,statusbar, hwndhwndBar
    gui,show,w300,[ahksushi] Statusbar Demo

    SB_SetParts(20,200,100)
    SB_SetText("demotext",2)
    hIS     := SB_SetIcon(A_AhkPath,1,1)
    hwnd := SB_SetProgress(50,3,"BackgroundGreen cLime")
    Gosub, Prep_Animation

    Restart:
       SB_SetProgress(0,3,"show")
       GuiControl,Disable,Btn1
       Gui,+LastFound
       ControlFocus
       pp := 0
       SetTimer,ProgressAnimation,50
    return

    ProgressAnimation:
       SB_SetProgress(++pp,3)
       R := mod(pp,8)//2+1
       SendMessage, 0x40F, 0, hI%R%,, ahk_id %hwndBar%     ; SB_SETICON := (WM_USER:=0x400) + 15 - icon animation!
       if (pp=100) {
          SendMessage, 0x40F, 0, hIS,, ahk_id %hwndBar%    ; StandardIcon hIS
          SB_SetText("`tEat mo' sushi!",2,0)               ; update Text
          SetTimer,ProgressAnimation,Off                   ; Timer OFF
          GuiControl,Enable,Btn1
          SB_SetText("`tDone!",3,0)                        ; update Text
          SB_SetProgress(0,3,"hide")                       ; hide the progress
       } else  ; update Text
          SB_SetText("`tLala lala la: " pp " %",2,0)
    Return

    Prep_Animation:
    ; Prepare Animation - Load 4 Icons and make their handle available
    hInst := DllCall("GetModuleHandle", "str", "shell32.dll")
    Loop,4
       hI%A_index% := DllCall("LoadImage", "Uint", hInst, "Uint", 3+A_index, "Uint", 1
                            , "int", 16, "int", 16, "Uint", 0x8000)
    Return

    GuiEscape:
    GuiClose:
       exitapp




The code for the function - include this either in every script u decide to use it, or put it directly into your StdLib (e.g. Path\To\Ahk.exe\lib\SB.ahk) with the desired filename SB.ahk

Code:
; SB_SetProgress
; (w) by DerRaphael / Released under the Terms of EUPL 1.0
; see http://ec.europa.eu/idabc/en/document/7330 for details

SB_SetProgress(Value=0,Seg=1,Ops="")
{
   ; Definition of Constants   
   Static SB_GETRECT      := 0x40a      ; (WM_USER:=0x400) + 10
        , SB_GETPARTS     := 0x406
        , SB_PROGRESS                   ; Container for all used hwndBar:Seg:hProgress
        , PBM_SETPOS      := 0x402      ; (WM_USER:=0x400) + 2
        , PBM_SETRANGE32  := 0x406
        , PBM_SETBARCOLOR := 0x409
        , PBM_SETBKCOLOR  := 0x2001
        , dwStyle         := 0x50000001 ; forced dwStyle WS_CHILD|WS_VISIBLE|PBS_SMOOTH

   ; Find the hWnd of the currentGui's StatusbarControl
   Gui,+LastFound
   ControlGet,hwndBar,hWnd,,msctls_statusbar321

   if (!StrLen(hwndBar)) {
      rErrorLevel := "FAIL: No StatusBar Control"     ; Drop ErrorLevel on Error
   } else If (Seg<=0) {
      rErrorLevel := "FAIL: Wrong Segment Parameter"  ; Drop ErrorLevel on Error
   } else if (Seg>0) {
      ; Segment count
      SendMessage, SB_GETPARTS, 0, 0,, ahk_id %hwndBar%
      SB_Parts :=  ErrorLevel - 1
      If ((SB_Parts!=0) && (SB_Parts<Seg)) {
         rErrorLevel := "FAIL: Wrong Segment Count"  ; Drop ErrorLevel on Error
      } else {
         ; Get Segment Dimensions in any case, so that the progress control
         ; can be readjusted in position if neccessary
         if (SB_Parts) {
            VarSetCapacity(RECT,16,0)     ; RECT = 4*4 Bytes / 4 Byte <=> Int
            ; Segment Size :: 0-base Index => 1. Element -> #0
            SendMessage,SB_GETRECT,Seg-1,&RECT,,ahk_id %hwndBar%
            If ErrorLevel
               Loop,4
                  n%A_index% := NumGet(RECT,(a_index-1)*4,"Int")
            else
               rErrorLevel := "FAIL: Segmentdimensions" ; Drop ErrorLevel on Error
         } else { ; We dont have any parts, so use the entire statusbar for our progress
            n1 := n2 := 0
            ControlGetPos,,,n3,n4,,ahk_id %hwndBar%
         } ; if SB_Parts

         If (InStr(SB_Progress,":" Seg ":")) {

            hWndProg := (RegExMatch(SB_Progress, hwndBar "\:" seg "\:(?P<hWnd>([^,]+|.+))",p)) ? phWnd :

         } else {

            If (RegExMatch(Ops,"i)-smooth"))
               dwStyle ^= 0x1

            hWndProg := DllCall("CreateWindowEx","uint",0,"str","msctls_progress32"
               ,"uint",0,"uint", dwStyle
               ,"int",0,"int",0,"int",0,"int",0 ; segment-progress :: X/Y/W/H
               ,"uint",DllCall("GetAncestor","uInt",hwndBar,"uInt",1) ; gui hwnd
               ,"uint",0,"uint",0,"uint",0)

            SB_Progress .= (StrLen(SB_Progress) ? "," : "") hwndBar ":" Seg ":" hWndProg

         } ; If InStr Prog <-> Seg

         ; HTML Colors
         Black:=0x000000,Green:=0x008000,Silver:=0xC0C0C0,Lime:=0x00FF00,Gray:=0x808080
         Olive:=0x808000,White:=0xFFFFFF,Yellow:=0xFFFF00,Maroon:=0x800000,Navy:=0x000080
         Red:=0xFF0000,Blue:=0x0000FF,Fuchsia:=0xFF00FF,Aqua:=0x00FFFF

         If (RegExMatch(ops,"i)\bBackground(?P<C>[a-z0-9]+)\b",bg)) {
              if ((strlen(bgC)=6)&&(RegExMatch(bgC,"i)([0-9a-f]{6})")))
                  bgC := "0x" bgC
              else if !(RegExMatch(bgC,"i)^0x([0-9a-f]{1,6})"))
                  bgC := %bgC%
              if (bgC+0!="")
                  SendMessage, PBM_SETBKCOLOR, 0
                      , ((bgC&255)<<16)+(((bgC>>8)&255)<<8)+(bgC>>16) ; BGR
                      ,, ahk_id %hwndProg%
         } ; If RegEx BGC
         If (RegExMatch(ops,"i)\bc(?P<C>[a-z0-9]+)\b",fg)) {
              if ((strlen(fgC)=6)&&(RegExMatch(fgC,"i)([0-9a-f]{6})")))
                  fgC := "0x" fgC
              else if !(RegExMatch(fgC,"i)^0x([0-9a-f]{1,6})"))
                  fgC := %fgC%
              if (fgC+0!="")
                  SendMessage, PBM_SETBARCOLOR, 0
                      , ((fgC&255)<<16)+(((fgC>>8)&255)<<8)+(fgC>>16) ; BGR
                      ,, ahk_id %hwndProg%
         } ; If RegEx FGC

         If ((RegExMatch(ops,"i)(?P<In>[^ ])?range((?P<Lo>\-?\d+)\-(?P<Hi>\-?\d+))?",r))
              && (rIn!="-") && (rHi>rLo)) {    ; Set new LowRange and HighRange
              SendMessage,0x406,rLo,rHi,,ahk_id %hWndProg%
         } else if ((rIn="-") || (rLo>rHi)) {  ; restore defaults on remove or invalid values
              SendMessage,0x406,0,100,,ahk_id %hWndProg%
         } ; If RegEx Range
     
         If (RegExMatch(ops,"i)\bEnable\b"))
            Control, Enable,,, ahk_id %hWndProg%
         If (RegExMatch(ops,"i)\bDisable\b"))
            Control, Disable,,, ahk_id %hWndProg%
         If (RegExMatch(ops,"i)\bHide\b"))
            Control, Hide,,, ahk_id %hWndProg%
         If (RegExMatch(ops,"i)\bShow\b"))
            Control, Show,,, ahk_id %hWndProg%

         ControlGetPos,xb,yb,,,,ahk_id %hwndBar%
         ControlMove,,xb+n1,yb+n2,n3-n1,n4-n2,ahk_id %hwndProg%
         SendMessage,PBM_SETPOS,value,0,,ahk_id %hWndProg%

      } ; if Seg greater than count
   } ; if Seg greater zero

   If (regExMatch(rErrorLevel,"^FAIL")) {
      ErrorLevel := rErrorLevel
      Return -1
   } else
      Return hWndProg

}

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Last edited by derRaphael on September 20th, 2009, 1:45 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 14th, 2008, 9:23 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
-reserved-


Last edited by derRaphael on November 14th, 2008, 9:25 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2008, 12:49 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
I haven't figured out where I'm gonna use it yet but it's way cool. Thanks for sharing. 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 15th, 2009, 5:26 am 
seems like the RegEx for the range is case-sensitive by accident,
( http://www.autohotkey.com/forum/topic45296.html )
the SB_SetProgress-function should probably be:
Code:
; SB_SetProgress
; (w) by DerRaphael / Released under the Terms of EUPL 1.0
; see http://ec.europa.eu/idabc/en/document/7330 for details

SB_SetProgress(Value=0,Seg=1,Ops="")
{
   ; Definition of Constants   
   Static SB_GETRECT      := 0x40a      ; (WM_USER:=0x400) + 10
        , SB_GETPARTS     := 0x406
        , SB_PROGRESS                   ; Container for all used hwndBar:Seg:hProgress
        , PBM_SETPOS      := 0x402      ; (WM_USER:=0x400) + 2
        , PBM_SETRANGE32  := 0x406
        , PBM_SETBARCOLOR := 0x409
        , PBM_SETBKCOLOR  := 0x2001
        , dwStyle         := 0x50000001 ; forced dwStyle WS_CHILD|WS_VISIBLE|PBS_SMOOTH

   ; Find the hWnd of the currentGui's StatusbarControl
   Gui,+LastFound
   ControlGet,hwndBar,hWnd,,msctls_statusbar321

   if (!StrLen(hwndBar)) {
      rErrorLevel := "FAIL: No StatusBar Control"     ; Drop ErrorLevel on Error
   } else If (Seg<=0) {
      rErrorLevel := "FAIL: Wrong Segment Parameter"  ; Drop ErrorLevel on Error
   } else if (Seg>0) {
      ; Segment count
      SendMessage, SB_GETPARTS, 0, 0,, ahk_id %hwndBar%
      SB_Parts :=  ErrorLevel - 1
      If ((SB_Parts!=0) && (SB_Parts<Seg)) {
         rErrorLevel := "FAIL: Wrong Segment Count"  ; Drop ErrorLevel on Error
      } else {
         ; Get Segment Dimensions in any case, so that the progress control
         ; can be readjusted in position if neccessary
         if (SB_Parts) {
            VarSetCapacity(RECT,16,0)     ; RECT = 4*4 Bytes / 4 Byte <=> Int
            ; Segment Size :: 0-base Index => 1. Element -> #0
            SendMessage,SB_GETRECT,Seg-1,&RECT,,ahk_id %hwndBar%
            If ErrorLevel
               Loop,4
                  n%A_index% := NumGet(RECT,(a_index-1)*4,"Int")
            else
               rErrorLevel := "FAIL: Segmentdimensions" ; Drop ErrorLevel on Error
         } else { ; We dont have any parts, so use the entire statusbar for our progress
            n1 := n2 := 0
            ControlGetPos,,,n3,n4,,ahk_id %hwndBar%
         } ; if SB_Parts

         If (InStr(SB_Progress,":" Seg ":")) {

            hWndProg := (RegExMatch(SB_Progress, hwndBar "\:" seg "\:(?P<hWnd>([^,]+|.+))",p)) ? phWnd :

         } else {

            If (RegExMatch(Ops,"i)-smooth"))
               dwStyle ^= 0x1

            hWndProg := DllCall("CreateWindowEx","uint",0,"str","msctls_progress32"
               ,"uint",0,"uint", dwStyle
               ,"int",0,"int",0,"int",0,"int",0 ; segment-progress :: X/Y/W/H
               ,"uint",DllCall("GetAncestor","uInt",hwndBar,"uInt",1) ; gui hwnd
               ,"uint",0,"uint",0,"uint",0)

            SB_Progress .= (StrLen(SB_Progress) ? "," : "") hwndBar ":" Seg ":" hWndProg

         } ; If InStr Prog <-> Seg

         ; HTML Colors
         Black:=0x000000,Green:=0x008000,Silver:=0xC0C0C0,Lime:=0x00FF00,Gray:=0x808080
         Olive:=0x808000,White:=0xFFFFFF,Yellow:=0xFFFF00,Maroon:=0x800000,Navy:=0x000080
         Red:=0xFF0000,Blue:=0x0000FF,Fuchsia:=0xFF00FF,Aqua:=0x00FFFF

         If (RegExMatch(ops,"i)\bBackground(?P<C>[a-z0-9]+)\b",bg)) {
              if ((strlen(bgC)=6)&&(RegExMatch(bgC,"i)([0-9a-f]{6})")))
                  bgC := "0x" bgC
              else if !(RegExMatch(bgC,"i)^0x([0-9a-f]{1,6})"))
                  bgC := %bgC%
              if (bgC+0!="")
                  SendMessage, PBM_SETBKCOLOR, 0
                      , ((bgC&255)<<16)+(((bgC>>8)&255)<<8)+(bgC>>16) ; BGR
                      ,, ahk_id %hwndProg%
         } ; If RegEx BGC
         If (RegExMatch(ops,"i)\bc(?P<C>[a-z0-9]+)\b",fg)) {
              if ((strlen(fgC)=6)&&(RegExMatch(fgC,"i)([0-9a-f]{6})")))
                  fgC := "0x" fgC
              else if !(RegExMatch(fgC,"i)^0x([0-9a-f]{1,6})"))
                  fgC := %fgC%
              if (fgC+0!="")
                  SendMessage, PBM_SETBARCOLOR, 0
                      , ((fgC&255)<<16)+(((fgC>>8)&255)<<8)+(fgC>>16) ; BGR
                      ,, ahk_id %hwndProg%
         } ; If RegEx FGC

         If ((RegExMatch(ops,"i)(?P<In>[^ ])?range((?P<Lo>\-?\d+)\-(?P<Hi>\-?\d+))?",r))
              && (rIn!="-") && (rHi>rLo)) {    ; Set new LowRange and HighRange
              SendMessage,0x406,rLo,rHi,,ahk_id %hWndProg%
         } else if ((rIn="-") || (rLo>rHi)) {  ; restore defaults on remove or invalid values
              SendMessage,0x406,0,100,,ahk_id %hWndProg%
         } ; If RegEx Range
     
         If (RegExMatch(ops,"i)\bEnable\b"))
            Control, Enable,,, ahk_id %hWndProg%
         If (RegExMatch(ops,"i)\bDisable\b"))
            Control, Disable,,, ahk_id %hWndProg%
         If (RegExMatch(ops,"i)\bHide\b"))
            Control, Hide,,, ahk_id %hWndProg%
         If (RegExMatch(ops,"i)\bShow\b"))
            Control, Show,,, ahk_id %hWndProg%

         ControlGetPos,xb,yb,,,,ahk_id %hwndBar%
         ControlMove,,xb+n1,yb+n2,n3-n1,n4-n2,ahk_id %hwndProg%
         SendMessage,PBM_SETPOS,value,0,,ahk_id %hWndProg%

      } ; if Seg greater than count
   } ; if Seg greater zero

   If (regExMatch(rErrorLevel,"^FAIL")) {
      ErrorLevel := rErrorLevel
      Return -1
   } else
      Return hWndProg

}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2009, 1:47 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
thx z_gecko,

i just updated the main script :)

greets
dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 6:32 pm 
Offline
User avatar

Joined: July 17th, 2008, 12:58 am
Posts: 270
i dont know if im missing something here but this is supposed to work on other guis than the first too right?

i tried this but it wont show up
Code:
  Gui 3: Default
  SB_SetParts(80,200), SB_SetProgress(10,2)


if i remove Gui 3: Default it shows up just fine in the statusbar on my 1st gui

_________________
QuickSubs | Popcorn Movie Db
All my scripts are just in AutoHotkey v1.0.48.05


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 7:33 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
this actually just works fine, with the code from above;

Code:
Gui,Add,Button, gGoGui3, Go GUI 3!
Gui,Show, h50 w200, Demo Gui 1
Return


GoGui3:
   Gui,3:Default
   Gui,add,text,w280 center,Some text for the gui!
   Gui,add,statusbar
   Gui,show,w300,Statusbar with Progress

   SB_SetParts(20,200,100) ; Make 3 different parts
   SB_SetText("demotext",2) ; Set a text segment 2
   SB_SetIcon(A_AhkPath,1,1) ; Set an Icon to 1st segment
   ; create a 50% progressbar with yellow background and blue bar
   hwnd := SB_SetProgress(50,3,"BackgroundYellow cBlue")
return

3GuiClose:
3GuiEscape:
GuiClose:
GuiEscape:
   ExitApp


greets
dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 8:00 pm 
Offline
User avatar

Joined: July 17th, 2008, 12:58 am
Posts: 270
looks like it had something to do with gui, show

i used to have gui, shot afer sb_setprogress and for some reason when i moved it before it it worked

thanks anyway for your quick reply

_________________
QuickSubs | Popcorn Movie Db
All my scripts are just in AutoHotkey v1.0.48.05


Report this post
Top
 Profile  
Reply with quote  
 Post subject: geoni
PostPosted: February 16th, 2010, 10:31 pm 
hello!
i got a little problem with your awesome function :D
its propably something simple but i cant figure it out

i have sb_setprogress on my gui n6 ( i dont know if this matters)
the progress bar shows up just fine but when i exit the gui with gui, destroy and then start gui n6 up again it doesnt show up anymore
i have tried to use the "show" option but that doesnt seem to work either

keep up the great work i really love this!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2010, 9:06 pm 
Offline

Joined: September 10th, 2009, 5:54 pm
Posts: 203
Options like color are not working on windows 7


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: geoni
PostPosted: November 9th, 2010, 3:40 pm 
Offline

Joined: December 18th, 2009, 4:12 pm
Posts: 6
Location: USA
Anonymous wrote:
hello!
i got a little problem with your awesome function :D
its propably something simple but i cant figure it out

i have sb_setprogress on my gui n6 ( i dont know if this matters)
the progress bar shows up just fine but when i exit the gui with gui, destroy and then start gui n6 up again it doesnt show up anymore
i have tried to use the "show" option but that doesnt seem to work either

keep up the great work i really love this!


I'm having this same issue...any resolution? Here's a test script. The Return Value is blank after re-creating the GUI, while the ErrorLevel is always 0. Please help!

Code:
#Include bin\SB_SetProgress.ahk

ShowGui:
Gui, 55:Add, Text, w70 h20 , This is a test.
Gui, 55:Add, Button, x+10 y+-20 w105 h20 gReloadGui, Click to reload Gui.
Gui, 55:Add, StatusBar
Gui, 55:Show, w200 h60, Testing Progress Bar

Gui, 55:Default
SB_SetParts(100,100)
SB_SetText("Testing...",1)
hwnd := SB_SetProgress(10,2,"show")
MsgBox, Return Value = %hwnd%`nErrorLevel = %ErrorLevel%
Return

ReloadGui:
Gui, 55:Destroy
GoTo, ShowGui
Return

55GuiClose:
ExitApp


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 9th, 2010, 8:31 pm 
Offline

Joined: December 18th, 2009, 4:12 pm
Posts: 6
Location: USA
The issue has to do with the "SB_PROGRESS" variable. I guess it stores a list of "hwndBar:Seg:hProgress" strings to avoid recreating a progress bar in the same StatusBar segment. However, once a GUI has been destroyed and rebuilt, the progress control doesn't exist in that numbered segment yet to be updated. The following code change resolves this issue:

Change line 48

Code:
If (InStr(SB_Progress, ":" Seg ":")) {


to

Code:
If (InStr(SB_Progress, hwndBar ":" Seg ":")) {


This takes into consideration the unique ID of the window, as well as the segment number. For a new window (recreated GUI), the progress bar will first be created before being updated.

Hope this helps someone out.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: please speed!!!
PostPosted: October 17th, 2011, 4:00 pm 
Offline

Joined: February 2nd, 2011, 9:36 am
Posts: 28
Ive tested sucessfully this func, but seems it take more than 16 milliseconds to work.

Please can be possible to speedup this progress? Maybe regex is very CPU hard...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, Google Feedfetcher, Yahoo [Bot] and 6 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group