 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Vinthian
Joined: 11 May 2008 Posts: 15 Location: USA
|
Posted: Mon May 12, 2008 10:02 pm Post subject: Multiple Button Labels |
|
|
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 |
|
 |
Elesar
Joined: 28 Jun 2007 Posts: 94
|
Posted: Mon May 12, 2008 10:59 pm Post subject: |
|
|
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 |
|
 |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Mon May 12, 2008 11:19 pm Post subject: |
|
|
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 |
|
 |
Elesar
Joined: 28 Jun 2007 Posts: 94
|
Posted: Tue May 13, 2008 12:56 am Post subject: |
|
|
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 |
|
 |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Tue May 13, 2008 1:27 am Post subject: |
|
|
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 |
|
 |
Elesar
Joined: 28 Jun 2007 Posts: 94
|
Posted: Tue May 13, 2008 1:27 am Post subject: |
|
|
No problem, glad to help  |
|
| 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
|