Sign in to follow this  
Followers 0
broodplank

_WaitButton

11 posts in this topic

#1 ·  Posted (edited)

This udf creates a button that count from whatever you want to 1 and then enables the button (could be useful for trials to let the ppl wait some sec :whistle:)

Usage:

_WaitButton($text, $left, $top, $width, $height, $time)

Example:

_WaitButton("Try", 5, 5, 60, 20, 10)

UDF:

;BY BROODPLANK
Func _WaitButton($text, $left, $top, $width, $height, $time)
$button = GUICtrlCreateButton($text, $left, $top, $width, $height, $WS_DISABLED)
$i = $time + 1
Do
    $i -= 1
    GUICtrlSetData($button, $i, $i)
    sleep(1000)

    if $i =  1 then 
        GUICtrlSetData($button, $text)
        GUICtrlSetStyle($button, "")
    EndIf

Until $i = 1
EndFunc

Working Example:

#include <Guiconstants.au3>
$button = ""

GUICreate("WAITBUTTON TEST", 200, 50)

GUISetState()

GUICtrlCreateLabel("Please wait until you can use this trial", 5, 5)

_WaitButton("Try", 5, 25, 60, 20, 10)

While 1
    $msg = GUIGetMsg()
    if $msg = $gui_event_close then Exit
    if $msg = $button then MsgBox(0, "WAITBUTTON", "You can now use this button")
WEnd

Func _WaitButton($text, $left, $top, $width, $height, $time)
$button = GUICtrlCreateButton($text, $left, $top, $width, $height, $WS_DISABLED)
$i = $time + 1
Do
    $i -= 1
    GUICtrlSetData($button, $i, $i)
    sleep(1000)

    if $i =  1 then 
        GUICtrlSetData($button, $text)
        GUICtrlSetStyle($button, "")
    EndIf

Until $i = 1
EndFunc
Edited by broodplank

Share this post


Link to post
Share on other sites



Simple, but I suppose this could be useful at some time.

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

Simple, but I suppose this could be useful at some time.

Kurt

ty for the feedback ;0

Share this post


Link to post
Share on other sites

nice, here some improvement

Func _WaitButton($text, $left, $top, $width, $height, $time)
    $button = GUICtrlCreateButton($text, $left, $top, $width, $height, $WS_DISABLED)
    GUICtrlSetData($button, $text)
    GUICtrlSetStyle($button, "")
    For $i = $time + 1 To 1 Step -1
        GUICtrlSetData($button, $i, $i)
        Sleep(1000)
    Next
EndFunc   ;==>_WaitButton

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

Share this post


Link to post
Share on other sites

Hi,

the Timer work by me not with autoit-v3.2.4.0 (Only with v3.2.2.0)

Can some one test this... THX

Share this post


Link to post
Share on other sites

Nice UDF, but could you change that Sleep(1000) function, cause it may stop some program actions.

Share this post


Link to post
Share on other sites

The WaitButton works by my only on

autoit-v3.2.2.0

Posted Image

Not on V.

autoit-v3.2.4.1

autoit-v3.2.4.2

Posted Image

Wy this?

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