AutoHotkey Community

It is currently May 26th, 2012, 11:20 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: November 16th, 2009, 6:06 pm 
Offline

Joined: February 9th, 2006, 8:01 pm
Posts: 117
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 6:37 pm 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
The v shouldn't be there.
Code:
GuiControl,, vTextvar_Time1, %Time1%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 6:45 pm 
Offline

Joined: February 9th, 2006, 8:01 pm
Posts: 117
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 7:47 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 8:26 pm 
Offline

Joined: February 9th, 2006, 8:01 pm
Posts: 117
thank you! That worked. I don't know why... but it worked!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 9:10 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 9:55 pm 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Cerberus, Google Feedfetcher, Maestr0, rbrtryn, Tipsy3000, XstatyK and 67 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group