Sign in to follow this  
Followers 0
Kivin

Progressbar error

2 posts in this topic

Hi everyone!

There is a script:

#include <GUIConstants.au3>
#include <Misc.au3>
$CurrentWindow = GUICreate( "",250,100, -1,-1)
$ProgressBarStartPosition = 0
$ProgressBarStep = 0.1
$ProgressBarCurrentPosition = 0
$ProgressBarMaxPosition = 100

$CopyProgressbar = GUICtrlCreateProgress (10,15,200,20)
$CopyProgressbarPercentLabel = GUICtrlCreateLabel ("0 %", 10,40,200,20,$SS_CENTER)
$start = GUICtrlCreateButton ("Start",10,60,70,22)
GUISetState ( @SW_SHOW, $CurrentWindow )

Func Progress()
        For $ProgressBarCurrentPosition = 0 To $ProgressBarMaxPosition Step $ProgressBarStep
        Dim $ProgressBarCurrentPosition
        GUICtrlSetData ( $CopyProgressbar, $ProgressBarCurrentPosition )
        GUICtrlSetData ( $CopyProgressbarPercentLabel, $ProgressBarCurrentPosition & " %" )
        Sleep ( 100 )
    Next 
EndFunc
Do
    $msg = GUIGetMsg ( 1 )  
    Select
    Case $msg [0] = $start
        Progress()
    EndSelect
Until $msg[0] = $GUI_EVENT_CLOSE

Main function is show progress.

When I push Start button, everything work fine.

But after $CopyProgressbarPercentLabel=>"6%" it began show 6.199999999% etc.

Where I mistaken?

I need only one nuber after point.

Also I want to know how to stop, pause, continue Func Progress()

Thanks for help!

Share this post


Link to post
Share on other sites



use round... check the help file...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

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