 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
charliemopps
Joined: 09 Feb 2006 Posts: 103
|
Posted: Mon Nov 16, 2009 5:06 pm Post subject: Need help with a simple counter |
|
|
I just want to push a button and add 1 to the variable, then update the GUI.
What am I doing wrong here?
| Code: | SetTitleMatchMode, 1
Time1 = 0
Gui, +AlwaysOnTop +toolwindow
Gui, Add, Text, vTextvar_Time1, %Time1%
Gui, Add, Button, x6 y30 w100 h20 ,Add
; Generated using SmartGUI Creator 4.0
Gui, Show, x1154 y0 h270 w118, Counter
Gui, Submit , NoHide
Return
ButtonAdd:
Time1 += 1
GuiControl,, vTextvar_Time1, %Time1%
return |
|
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 1770 Location: MN, USA
|
Posted: Mon Nov 16, 2009 5:37 pm Post subject: |
|
|
The v shouldn't be there.
| Code: | | GuiControl,, vTextvar_Time1, %Time1% |
_________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
charliemopps
Joined: 09 Feb 2006 Posts: 103
|
Posted: Mon Nov 16, 2009 5:45 pm Post subject: |
|
|
Still no worky:
| Code: | SetTitleMatchMode, 1
Time1 = 0
Gui, +AlwaysOnTop +toolwindow
Gui, Add, Text, vTextvar_Time1, %Time1%
Gui, Add, Button, x6 y30 w100 h20 ,Add
; Generated using SmartGUI Creator 4.0
Gui, Show, x1154 y0 h270 w118, Counter
Gui, Submit , NoHide
Return
ButtonAdd:
Time1 += 1
GuiControl,, Textvar_Time1, %Time1%
return |
|
|
| Back to top |
|
 |
Guest
|
Posted: Mon Nov 16, 2009 6:47 pm Post subject: |
|
|
| Code: | SetTitleMatchMode, 1
Time1 = 0
Gui, +AlwaysOnTop +toolwindow
Gui, Add, Text, vTextvar_Time1, %Time1%
Gui, Add, Button,gButtonAdd x6 y30 w100 h20 ,Add
; Generated using SmartGUI Creator 4.0
Gui, Show, x1154 y0 h270 w118, Counter
Gui, Submit , NoHide
Return
ButtonAdd:
Time1 += 1
GuiControl,, Textvar_Time1, %Time1%
return |
|
|
| Back to top |
|
 |
charliemopps
Joined: 09 Feb 2006 Posts: 103
|
Posted: Mon Nov 16, 2009 7:26 pm Post subject: |
|
|
| thank you! That worked. I don't know why... but it worked! |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Nov 16, 2009 8:10 pm Post subject: |
|
|
if u dont know why, read the "red" highlighted text again
first, u created a button GUI, but didnt hook it to ButtonAdd function
second, in GUI, vTextvar_Time1 means variable "Textvar_Time1", so when u use it as a variable, u dont need to include the v |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 1770 Location: MN, USA
|
Posted: Mon Nov 16, 2009 8:55 pm Post subject: |
|
|
| Anonymous wrote: | | u created a button GUI, but didnt hook it to ButtonAdd function |
| AHK Help File wrote: | | If a button lacks an explicit g-label, an automatic label is assumed. | gButtonAdd is not needed. _________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|