Jump to content

Reverse progress bar (countdown style), nested tabs


Recommended Posts

Heya!

I'm new to AutoIt and I love it! But, I was wondering if the following things are possible (I can't figure out how, and I've read the docs and experimented):

- A progress bar that starts on the right, such as for display of a countdown timer.

- Nested tabs, i.e. a page of tabs contained on one page of another page of tabs. I've managed this with Auto3Lib since it appears to call User32 directly, but the handles are thus incompatible with most of the rest of AutoIt, and I much prefer AutoIt's built-in methods for handling tabs. If I have to go with Auto3Lib, then how do I make the tab "pages" work? Manually show and hide the objects on them?

- What the heck is the default font that user32 uses when putting labels on stuff. I've heard Tahoma, but that's not it.

Thanks!

Justin

Link to comment
Share on other sites

Hi,

Here's a poor over blown 10 second progress countdown example.

The reason it's overblown is I tried to make it so the script can still do other things while the progress is counting down.

eg: Like respond to the Gui controls..lol

#include <GUIConstants.au3>

Global $i = 100, $AdState

$Gui = GUICreate("Countdown", 170, 70)
$Progress = GUICtrlCreateProgress(10, 10, 150, 20)
GUICtrlSetData(-1, $i)
$Button = GUICtrlCreateButton("Start Countdown", 10, 40, 150, 20) 
GUISetState(@SW_SHOW, $GUI)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            If $AdState = 1 Then AdlibDisable()
            Exit
        Case $msg = $Button
            If GUICtrlRead($Button) = "Start Countdown" Then    
                AdlibEnable("Countdown", 100)
                $AdState = 1
                GUICtrlSetData($Button, "Pause Countdown")
            ElseIf GUICtrlRead($Button) = "Pause Countdown" Then
                AdlibDisable()
                $AdState = 0
                GUICtrlSetData($Button, "Continue Countdown")
            ElseIf GUICtrlRead($Button) = "Continue Countdown" Then     
                AdlibEnable("Countdown", 100)
                $AdState = 1
                GUICtrlSetData($Button, "Pause Countdown")                  
            EndIf   
    EndSelect       
WEnd

Func Countdown()
    $i -= 1
    GUICtrlSetData($Progress, $i)
    WinSetTitle($Gui, "", "Seconds: " & Round($i/10))
    If $i = 0 Then 
        AdlibDisable()
        $AdState = 0
        GUICtrlSetData($Button, "Start Countdown")
        $i = 100
        WinSetTitle($Gui, "", "Countdown")
        GUICtrlSetData($Progress, $i)
    EndIf   
EndFunc

As for your tab and font questions I haven't looked into it..

Cheers

Edited by smashly
Link to comment
Share on other sites

Hi,

Here's a poor over blown 10 second progress countdown example.

The reason it's overblown is I tried to make it so the script can still do other things while the progress is counting down.

eg: Like respond to the Gui controls..lol

As for your tab and font questions I haven't looked into it..

Cheers

Thanks! That code is very helpful as it describes message handling and the logic of the timer (which I also havn't done yet), but what I mean is... I would like the progress bar to remove blocks starting from the left as the timer counts down (i.e. 0 for the control value begins on the right).

Edited by alakani
Link to comment
Share on other sites

Heya!

I'm new to AutoIt and I love it! But, I was wondering if the following things are possible (I can't figure out how, and I've read the docs and experimented):

- A progress bar that starts on the right, such as for display of a countdown timer.

ProgressOn("Erasing: C:\bad_file.ext", "Erasing File (Example Only!)", "NOTHING is being deleted.", -1, -1, 16)
ProgressSet(100)
Sleep(2000)
For $i = 100 To 0 Step -10
ProgressSet($i)
Sleep(1000)
Next
ProgressSet(0, "File has been erased (No it hasn't!)", "Done!")
Sleep(4000)

- Nested tabs, i.e. a page of tabs contained on one page of another page of tabs. I've managed this with Auto3Lib since it appears to call User32 directly, but the handles are thus incompatible with most of the rest of AutoIt, and I much prefer AutoIt's built-in methods for handling tabs. If I have to go with Auto3Lib, then how do I make the tab "pages" work? Manually show and hide the objects on them?

From the manual under GUICtrlCreateTab:

"ONLY one Tab control can be created by window. But a script can creates several windows having a tab in."

- What the heck is the default font that user32 uses when putting labels on stuff. I've heard Tahoma, but that's not it.

I'm thinking system default. I'm guessing of course, but that seems logical to me. I could be wrong.
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...