AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help with a simple counter

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
charliemopps



Joined: 09 Feb 2006
Posts: 103

PostPosted: Mon Nov 16, 2009 5:06 pm    Post subject: Need help with a simple counter Reply with quote

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
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 1770
Location: MN, USA

PostPosted: Mon Nov 16, 2009 5:37 pm    Post subject: Reply with quote

The v shouldn't be there.
Code:
GuiControl,, vTextvar_Time1, %Time1%

_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
charliemopps



Joined: 09 Feb 2006
Posts: 103

PostPosted: Mon Nov 16, 2009 5:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Mon Nov 16, 2009 6:47 pm    Post subject: Reply with quote

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

PostPosted: Mon Nov 16, 2009 7:26 pm    Post subject: Reply with quote

thank you! That worked. I don't know why... but it worked!
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Nov 16, 2009 8:10 pm    Post subject: Reply with quote

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

PostPosted: Mon Nov 16, 2009 8:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group