Jump to content

ProgressBar


Recommended Posts

Hi forum,today I asked to me when i write i ProgressBar...It's possible to write into a progressbar, for esample :

I would like to write in the progress bar, i've try with GuiCtrlSetData function but don't work.

Hello :D

Write what? Post a short demo script that shows what doesn't work for you. GuiCtrlSetData() works fine to write the percentage to a progress bar created with GuiCtrlCreateProgress(). Use ProgressSet() if you created it with ProgressOn(). If it's from a foreign window's controls then it depends on how that app drew the progress bar.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hi forum,today I asked to me when i write i ProgressBar...It's possible to write into a progressbar, for esample :

Posted Image

I would like to write in the progress bar, i've try with GuiCtrlSetData function but don't work.

Hello :D

That looks like you are using the standard progressbar and not GUICtrlCreateProgress() so the short answer to your question is "no". Not to mention that the GUICtrlSetdata() function only works with GUI Controls in an AutoIt GUI that was created using GUICreate().

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

It`s very easy to do.

#Include <GUIConstantsEx.au3>
#Include <StaticConstants.au3>

GUICreate('MyGUI', 400, 101)
$Progress = GUICtrlCreateProgress(20, 40, 360, 21)
$Label = GUICtrlCreateLabel('100%', 170, 43, 60, 14, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 9, 800)
GUISetState()

$Percent = 0
$Timer = TimerInit()
While 1
    If TimerDiff($Timer) > 150 Then
        $Timer = TimerInit()
        $Percent += 5
        If $Percent > 100 Then
            $Percent = 0
        EndIf
        GUICtrlSetData($Progress, $Percent)
        GUICtrlSetData($Label, $Percent & '%')
    EndIf
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
Link to comment
Share on other sites

Again, look at the image. That appears to be a standard progress dialog created with ProgressOn() not GUICtrlCreateProgress().

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Link to comment
Share on other sites

What prevents OP to write your own ProgressBar.

Absolutly nothing. I was just refering to the image in his first post where a bit of code would have provided the direction to take to solve the problem.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

i tryed a little bit around:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $progressbar1, $progressbar2, $button, $wait, $s, $msg, $m, $p1
    
    GUICreate("My GUI Progressbar", 220, 100, 100, 200)
    $progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
    $p1 = GUICtrlCreateLabel ("test", 10, 10, 200, 20, $SS_CENTER )
    GUICtrlSetBkColor ( -1, $GUI_BKCOLOR_TRANSPARENT)
    $button = GUICtrlCreateButton("Start", 75, 70, 70, 20)
    GUISetState()

    $wait = 20; wait 20ms for next progressstep
    $s = 0; progressbar-saveposition
    Do
        $msg = GUIGetMsg()
        If $msg = $button Then
            GUICtrlSetData($button, "Stop")
            For $i = $s To 100
                $m = GUIGetMsg()
                If $m = -3 Then ExitLoop
                If $m = $button Then
                    GUICtrlSetData($button, "Next")
                    $s = $i;save the current bar-position to $s
                    ExitLoop
                Else
                    $s = 0
                    GUICtrlSetData($progressbar1, $i)
                    GUICtrlSetData ( $p1, "test")
                    Sleep($wait)
                EndIf
            Next
            If $i > 100 Then
                GUICtrlSetData($button, "Start")
                GUICtrlSetData ( $p1, "test")
            endif
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc

at the end the "test" label is gone. dont know why....

Link to comment
Share on other sites

It`s very easy to do.

#Include <GUIConstantsEx.au3>
#Include <StaticConstants.au3>

GUICreate('MyGUI', 400, 101)
$Progress = GUICtrlCreateProgress(20, 40, 360, 21)
$Label = GUICtrlCreateLabel('100%', 170, 43, 60, 14, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 9, 800)
GUISetState()

$Percent = 0
$Timer = TimerInit()
While 1
    If TimerDiff($Timer) > 150 Then
        $Timer = TimerInit()
        $Percent += 5
        If $Percent > 100 Then
            $Percent = 0
        EndIf
        GUICtrlSetData($Progress, $Percent)
        GUICtrlSetData($Label, $Percent & '%')
    EndIf
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Is it possible to draw text by opaque color to its background?

Something like progressbar component from Delphi. You can see it in Total Commander's file copy dialog.

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...