Sign in to follow this  
Followers 0
damien89x

Few quick questions

3 posts in this topic

Hi All,

Few quick questions that I’m hoping you will be able to answer.

1. I need a quick simple line of code to clear a text field created with GuiCtrlCreateInput when I press a button.

2. I am after a way to put a little clock on my dashboard/launcher. I am able to have it stamp the current time when I open it, but I am unable to have it continually update with the system time. Is that possible, would anyone be able to point me in the right direction?

Eg case $msg = $clearbox

*CLEAR BOX CODE HERE*

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Case $Btn_Clear
GUICtrlSetData($Input, "")

- edit -

probably not the best way for your second question ...

GUICreate("Example", 150, 75, -1, -1)
$Input = GUICtrlCreateLabel('', 15, 50, 118, 15)
GUISetState()
While 1
Sleep(250)
$DateTime = @MON & "/" & @MDAY & "/" & @YEAR & "    " & @HOUR & ":" & @MIN & ":" & @SEC
GUICtrlSetData($Input, $DateTime)
WEnd
Edited by ripdad

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

A control loop like this will give you both constant polling of events (buttons, inputs, etc) and an independant timer to perform some periodic refresh:

#Include <Timers.au3>
$delay = 2000 ; milliseconds

$timer = _Timer_Init()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Button_Whatever
            Do the voodoo that you do here
        Case $Button_Clear
            Clear_Fields()
        Case $Button_Exit, $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    If _Timer_Diff($timer) > $delay Then
        Beep(800,50) ; refresh the auditory nerve
        $timer = _Timer_Init()
    EndIf
Wend
Exit
Edited by Spiff59

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