 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
vital
Joined: 05 Oct 2005 Posts: 17 Location: china
|
Posted: Wed Mar 21, 2007 3:18 pm Post subject: Does gui edit control has a enter event? |
|
|
the gui has not any button,only a edit control. i want that when i input any text then stroke enter key, trigger a label.how can i do?
thanks |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Wed Mar 21, 2007 3:34 pm Post subject: |
|
|
| Quote: | | In v1.0.35+, a g-label such as gMySubroutine may be listed in the control's options. This would cause the MySubroutine label to be launched automatically whenever the user or the script changes the contents of the control. |
|
|
| Back to top |
|
 |
vital
Joined: 05 Oct 2005 Posts: 17 Location: china
|
Posted: Wed Mar 21, 2007 3:45 pm Post subject: |
|
|
thans bobo
bui i do not want that.
example: i want input "calc" and press enter to run calc.exe, but when i input the first letter "c",the g-label was triggered at once. |
|
| Back to top |
|
 |
Helpy Guest
|
Posted: Wed Mar 21, 2007 5:07 pm Post subject: |
|
|
| If I recall correctly, a way to do this is to create an hidden default Button, which will catch the Enter event. |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Wed Mar 21, 2007 5:25 pm Post subject: |
|
|
The easiest is to use a hidden button
| Code: | Gui, Add, Edit, w200 h20 -WantReturn vEditContents
Gui, Add, Button, x-10 y-10 w1 h1 +default gGetContents
Gui Show
Return
GetContents:
Gui, Submit, NoHide
MsgBox % EditContents
Return
GuiClose:
ExitApp
Return |
You could simply set a hotkey too
| Code: | Gui, Add, Edit, w200 h20 vEditContents
Gui Show
Return
#IfWinActive ahk_class AutoHotkeyGUI
Enter::
Gui, Submit, NoHide
MsgBox % EditContents
Return
#IfWinActive
GuiClose:
ExitApp
Return |
|
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Wed Mar 21, 2007 5:49 pm Post subject: |
|
|
| Quote: | | example: i want input "calc" and press enter to run calc.exe, but when i input the first letter "c",the g-label was triggered at once. | So what?
| Code: | Gui, Add, Edit, vMyEdit gMyLabel
Gui, Show
return
MyLabel:
Gui, Submit, NoHide
If (MyEdit = "calc")
Run , calc.exe
Return | Not tested. |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Wed Mar 21, 2007 5:55 pm Post subject: |
|
|
| Code: | Gui, Add, Edit, vMyEdit gMyLabel
Gui, Show
return
MyLabel:
Sleep, 800
Gui, Submit, NoHide
If (MyEdit = "calc")
Run , calc.exe
Return | That way it won't start calc.exe even if you'll enter a word like "calculation" (depends on if you type additional characters within the delay of 800ms.) Tested. |
|
| Back to top |
|
 |
vital
Joined: 05 Oct 2005 Posts: 17 Location: china
|
Posted: Wed Mar 21, 2007 6:06 pm Post subject: |
|
|
| thanks n-l-i-d and BoBo very much! |
|
| 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
|