Sign in to follow this  
Followers 0
big_daddy

Marquee Style Progress Control

8 posts in this topic

#1 ·  Posted (edited)

There was a request for a Marquee Style Progress Control, so I did some research and came up with these.

Requires: AutoIt Beta and Windows XP or later

;===============================================================================
;
; Function Name:    _GUICtrlProgressMarqueeCreate()
; Description:      Creates a marquee sytle progress control
; Parameter(s):     $i_Left     - The left side of the control
;                   $i_Top      - The top of the control
;                   $i_Width    - Optional: The width of the control
;                   $i_Height   - Optional: The height of the control
; Requirement(s):   AutoIt3 Beta and Windows XP or later
; Return Value(s):  On Success - Returns the identifier (controlID) of the new control
;                  On Failure - Returns 0  and sets @ERROR = 1
; Author(s):        Bob Anthony
;
;===============================================================================
;
Func _GUICtrlProgressMarqueeCreate($i_Left, $i_Top, $i_Width = Default, $i_Height = Default)
    
    Local Const $PBS_MARQUEE = 0x08
    
    Local $v_Style = $PBS_MARQUEE
    
    Local $h_Progress = GUICtrlCreateProgress($i_Left, $i_Top, $i_Width, $i_Height, $v_Style)
    If $h_Progress = 0 Then
        SetError(1)
        Return 0
    Else
        SetError(0)
        Return $h_Progress
    EndIf
    
EndFunc;==>_GUICtrlProgressMarqueeCreate

;===============================================================================
;
; Function Name:    _GUICtrlProgressSetMarquee()
; Description:      Sets marquee sytle for a progress control
; Parameter(s):     $h_Progress - The control identifier (controlID)
;                   $f_Mode     - Optional: Indicates whether to turn the marquee mode on or off
;                                   0 = turn marquee mode off
;                                   1 = (Default) turn marquee mode on
;                   $i_Time     - Optional: Time in milliseconds between marquee animation updates
;                                   Default is 100 milliseconds
; Requirement(s):   AutoIt3 Beta and Windows XP or later
; Return Value(s):  On Success - Returns whether marquee mode is set
;                  On Failure - Returns 0  and sets @ERROR = 1
; Author(s):        Bob Anthony
;
;===============================================================================
;
Func _GUICtrlProgressSetMarquee($h_Progress, $f_Mode = 1, $i_Time = 100)
    
    Local Const $WM_USER = 0x0400
    Local Const $PBM_SETMARQUEE = ($WM_USER + 10)
    
    Local $var = GUICtrlSendMsg($h_Progress, $PBM_SETMARQUEE, $f_Mode, Number($i_Time))
    If $var = 0 Then
        SetError(1)
        Return 0
    Else
        SetError(0)
        Return $var
    EndIf
    
EndFunc;==>_GUICtrlProgressSetMarqueeoÝ÷ Øw«z+ìZ^¡ûazëjëh×6#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$GUI = GUICreate("Marquee Progress Bar", 200, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE")

$GUI_Progress = _GUICtrlProgressMarqueeCreate(50, 25, 100, 20)
$GUI_Button_Start = GUICtrlCreateButton("Start", 40, 50)
GUICtrlSetOnEvent(-1, "Progress_Start")
$GUI_Combo = GUICtrlCreateCombo("", 78, 52, 50)
GUICtrlSetData(-1,"1|10|50|100|300|500") 
GUICtrlSetOnEvent(-1, "Progress_Time")
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 135, 50)
GUICtrlSetOnEvent(-1, "Progress_Stop")
GUISetState()

While 1
    Sleep(100)
WEnd

Func Progress_Start()
    _GUICtrlProgressSetMarquee($GUI_Progress)
EndFunc;==>Progress_Start

Func Progress_Stop()
    _GUICtrlProgressSetMarquee($GUI_Progress, 0)
EndFunc;==>Progress_Stop

Func Progress_Time()
    $iTime = GUICtrlRead($GUI_Combo)
    _GUICtrlProgressSetMarquee($GUI_Progress, 1, $iTime)
EndFunc;==>Progress_Time

Func GUI_CLOSE()
    Exit
EndFunc;==>GUI_CLOSE

Edit: Add Image

Edit: Updated Example

Edit: Added Syntax Highlighting

Edited by big_daddy

Share this post


Link to post
Share on other sites



Before I looked at the sample, I didnt know what the marquee progress control was. Nice little UDF you have here. I had to include the UDF to get it to work, of course.

Nice job.

Share this post


Link to post
Share on other sites

Thanks, Very nice. :)


"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites

this is a great little script. I'll definitly include it for my XP auto-install project

Share this post


Link to post
Share on other sites

How would I go about setting the data of the Progress Bar to ""? It seems no matter what I do, it ends up showing 4 bars on creation.

Sorry, but I was unable to find a solution for you on this.

Share this post


Link to post
Share on other sites

Sorry, but I was unable to find a solution for you on this.

Well I appreciate you looking, please let me know if you find one in the future. I'm probably going to use marquee anyway, it's just odd looking when the control has not yet been used, but has data... heh


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

don't feel like searching but i think gafrost made one of these a long while ago

but still, neat

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0