Jump to content

Anyone ever do a reverse Progress Bar (right-to-left)?


Recommended Posts

Has anyone done a reverse progress bar? (starts from the right)

I'm trying to do a progress bar where it goes to 100% at the right and then resets and goes to 100% on the left. I rigged up a quickie ghetto way with reversing the progress color and background, thereby giving the illusion that it's going to the left on the second pass, but you see a slight line from the dark background on the 2nd pass. It looks pretty decent though.

So how can you start the progress from the right side? Is this even possible?

Here's what I got so far:

#include <GUIConstants.au3>

GUICreate("My GUI Progressbar",300,100,-1,-1)
$progressbar1 = GUICtrlCreateProgress (25,40,250,20,$PBS_SMOOTH)
GUICtrlSetColor(-1,000066)
$progressbar2 = GUICtrlCreateProgress (25,40,250,20,$PBS_SMOOTH)
GUICtrlSetColor(-1,0xD4D0C8)
GUICtrlSetBkColor(-1,000066)
GUISetState()

$wait = 20

While 1
        For $i = 0 To 100 Step 1
            GUICtrlSetData($progressbar1,$i)
            Sleep($wait)
        Next
        For $i = 0 To 100 Step 1
            GUICtrlSetData($progressbar2,(100 - $i))
            Sleep($wait)
        Next    
WEnd
Link to comment
Share on other sites

I dont think that this is possible (anyway even if it is, thah is not easy for sure)

My idea for now :)

#include <GUIConstants.au3>

GUICreate("My GUI Progressbar",300,100,-1,-1)
$progressbar1 = GUICtrlCreateProgress (25,40,250,20,$PBS_SMOOTH)
GUICtrlSetColor(-1,000066)
$progressbar2 = GUICtrlCreateProgress (25,40,250,20,$PBS_SMOOTH)
GUICtrlSetColor(-1,0xD4D0C8)
GUICtrlSetBkColor(-1,000066)
GUISetState()
$label=GUICtrlCreateLabel("",27,42,248,16)
GUICtrlSetBkColor(-1,0xFFFFFF)
GUICtrlSetState(-1,$GUI_HIDE)
$wait = 20

While 1
        For $i = 0 To 100 Step 1
            GUICtrlSetData($progressbar1,$i)
            Sleep($wait)
        Next
        GUICtrlSetState(-1,$GUI_SHOW)
        GUICtrlSetData($progressbar2,(100))
        For $i = 0 To 245 Step 5
            GUICtrlSetPos ($label, 27,42,245-$i,16)
            Sleep($wait*2)
        Next    
WEnd
Edited by Uriziel01
Link to comment
Share on other sites

...So how can you start the progress from the right side? Is this even possible?

..

There are some ideas in this thread which could be adapted easily to make a reverse version.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

There are some ideas in this thread which could be adapted easily to make a reverse version.

No I'm afraid that has nothing to do with reversing direction, just changing the look of the bar.

Mine works fine enough. It looks good for what I need, but it's not universal since it only works witht eh standard Win2k/XP grey windows. Thanks everyone.

Link to comment
Share on other sites

No I'm afraid that has nothing to do with reversing direction, just changing the look of the bar.

Post 3 in that thread uses exactly the same idea as Uriziel01 used for a label but with a Pic.

If you make a very small change to post 3 in that thread you get this, but you need

saved in the script directory first.
#include <GUIConstants.au3>

$gui = GUICreate("My GUI"); will create a dialog box that when displayed is centered
$pic = guictrlcreatepic("gradientbar.bmp",20,50,5,15)
GUISetState (@SW_SHOW)
for $n = 1 to 200
    ControlMove($gui,"",$pic,200-$n + 20,50,5 + $n,15)
    sleep(20)
Next

while guigetmsg() <> -3
    
    WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...