Selecting/Prioritizing a GUI button
Posted: 12 Dec 2018, 09:43
After executing this script, I still need to tab my way to the OK button. I'm trying to figure out how to prioritize the button, so that once GUI appears, all you do is hit enter on keyboard. Kind of like most windows GUI's.
Code: Select all
Gui, Add, Button, x40 y60 w80 h30 , OK
Gui, Add, Button, x180 y60 w80 h30 , Cancel
Gui, Show, x800 y500 h150 w300, INPUT
Return
ButtonCancel:
GuiEscape:
Gui, Destroy
Enter:
NumpadEnter:
ControlGetFocus, myFocus, INPUT, Button1
if (myFocus = "Button1")
{
Goto, ButtonOK
}
else
if (myFocus = "Edit2" or "Button2")
{
Gui, Destroy
Exit
}
ButtonOK:
Gui, Submit
Gui, Destroy