That's not true if you switch the keyboard focus to another button using GuiControl, Focus.Button wrote:The example above includes the word Default in its Options to make "OK" the default button. The default button's action is automatically triggered whenever the user presses ENTER, except when the keyboard focus is on a different button ...
Code: Select all
#NoEnv
Gui, Margin, 20, 20
Gui, Add, Text, , Press ENTER to trigger the focused button.
Gui, Add, Button, wp Default vBtnD gDefaultButton, Default
Gui, Add, Button, wp vBtnF gFocusedButton, Focused
GuiControl, Focus, BtnF
Gui, Show, , Test
Return
GuiClose:
ExitApp
DefaultButton:
FocusedButton:
MsgBox, %A_ThisLabel% was triggered!
Return
Edit: Updated the OldNewThing link.