Jump to content

Few quick questions


Recommended Posts

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

Link to comment
Share on other sites

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

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

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