| View previous topic :: View next topic |
| Author |
Message |
a_guy Guest
|
Posted: Sat Feb 20, 2010 2:48 am Post subject: Constant loop while a gui exists |
|
|
Hello,
I have wrote a gui that I plan on having do some things with clocks and timers. Once I hit a button, a time is put into a text field. How can I have a loop that is ALWAYS executing while the gui is alive that could say, decrement a second (I don't need help with decrementing a second, only the placement of said loop). I tried placing after the full code of the gui and nothing happened. Any help would be much appreciated. |
|
| Back to top |
|
 |
randallf
Joined: 06 Jul 2009 Posts: 678
|
Posted: Sat Feb 20, 2010 3:21 am Post subject: |
|
|
| Code: | #Persistant
Loop
{
IfWinExist, Wintitle Of Your GUI
msgbox
}
|
not complete but might point you in the right direction for the help file |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 5334 Location: San Diego, California
|
Posted: Sat Feb 20, 2010 3:43 am Post subject: |
|
|
I think of GUI interfaces as static, meaning non-moving.
GUI interfaces are also economical, they are drawn and done without wasting time.
They only change based on something happening. In fact most of the scripts I have seen there is a Return instruction just after the Gui, show command.
Given those ideas, why not use something that is also economical: SetTimer. It can be set to call a subroutine as often as you like. It can increment a variable and finish, then wait until the next settimer calls it.
You can use this to show "elapsed time".
If you need something that allows a value to be placed in a field based on when the gui was shown an when you pushed the button consider reading and storing a copy of the variables A_Now or A_TickCount. Just after showing the GUI read and store one of those variables, later when you push a button read the variable again. If you subtract the stored value from the last, you get how long between GUI-shown and button-pushed.
If you want to use the SetTimer command to start a subroutine, place the SetTimer command after GUI, show and before Return. |
|
| Back to top |
|
 |
randallf
Joined: 06 Jul 2009 Posts: 678
|
Posted: Sat Feb 20, 2010 3:46 am Post subject: |
|
|
If all you want to do is change text on something without killing the GUI the command specifically (for text and edit fields) is
| Code: | | GuiControl,,ControlVlabel, This is the new text |
|
|
| Back to top |
|
 |
|