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 

Multiple Button Labels

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



Joined: 11 May 2008
Posts: 15
Location: USA

PostPosted: Mon May 12, 2008 10:02 pm    Post subject: Multiple Button Labels Reply with quote

In a script where you use multiple gui's, how would you differentiate between which gui the buttonok label affect?

e.g.
Code:

text2 := window2
text3 := window3

^A::
gosub, window2
return
^B::
gosub, window3
return

window2:
Gui, 2:Add, Edit, text2 w90 h20, text2
Gui, 2:Add, Button, w90 h20 , OK
Gui, 2:Add, Button, w90 h20 , Cancel
Gui, 2:Show
return

window3:
Gui, 3:Add, Edit, text2 w90 h20, text2
Gui, 3:Add, Button, w90 h20 , OK
Gui, 3:Add, Button, w90 h20 , Cancel
Gui, 3:Show
return

ButtonOK:
Gui, Submit
Gui, Destroy
return

ButtonCancel:
GuiClose:
Gui, Cancel
Gui, Destroy
return
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Elesar



Joined: 28 Jun 2007
Posts: 94

PostPosted: Mon May 12, 2008 10:59 pm    Post subject: Reply with quote

If you have an ok button on GUI 1 and GUI 2, you would do the following:

Code:

ButtonOk: ; Button for fisrt GUI
  Do Something
  Return

2ButtonOk: ; Button for second GUI
  Do Something Else
  Return
Back to top
View user's profile Send private message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Mon May 12, 2008 11:19 pm    Post subject: Reply with quote

Hi Elesar.

Im just courious about that question cause ill need somethng like that on a script im working right now.

Question:

How does the script knows wich is the button and 2button if there are no references on the GUI code?
Back to top
View user's profile Send private message
Elesar



Joined: 28 Jun 2007
Posts: 94

PostPosted: Tue May 13, 2008 12:56 am    Post subject: Reply with quote

When you make your GUI code, you should have something like this:

Code:

Gui, Add, Button, x6 y6 w100 h20, Ok ; This is your first GUI, with the first Ok button
Gui, Show, x100 y100, First

Gui, 2:Add, Button, x6 y6 w100 h20, Ok ; This is your second GUI, with the second Ok button
Gui, 2:Show, x300 y100, Second
Return

ButtonOk:
  MsgBox, You clicked the first OK!
  Return

2ButtonOk:
  MsgBox, You clicked the second OK!
  Return


Got to run, back in a bit......
Back to top
View user's profile Send private message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Tue May 13, 2008 1:27 am    Post subject: Reply with quote

I got it!!!!

The reference is as follows:

Gui, Add, Buttun ... = Button ok
Gui, 2:Add, Buttun ... = 2Button ok
Gui, 3:Add, Buttun ... = 3Button ok

and so on....

That tip rings the bell!!!!

Thanks a lot Elesar!!!!!!!!!
Back to top
View user's profile Send private message
Elesar



Joined: 28 Jun 2007
Posts: 94

PostPosted: Tue May 13, 2008 1:27 am    Post subject: Reply with quote

No problem, glad to help Very Happy
Back to top
View user's profile Send private message
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