Jump to content

GUI Button Press with {Enter} key


StAbb
 Share

Recommended Posts

Hey does anyone know of a way to make it so that after you fill out some input boxes in a form with a button, you just press {enter} and have that click the "Submit" button or whatever the button is? Thanks in advance!

Link to comment
Share on other sites

You could also use GUISetAccelerators:

CODE
; A simple custom messagebox that uses the MessageLoop mode

#include <GUIConstantsEx.au3>

GUICreate("Custom Msgbox", 210, 80)

GUICtrlCreateLabel("Please click ENTER! Or SHIFT-ENTER", 10, 10)

$SHIFT_ENTERDUMMY = GUICtrlCreateDummy()

$ENTERBUTTON = GUICtrlCreateButton("Press Enter",10,30,100,30)

; Set accelerators for Ctrl+y and Ctrl+n

Dim $AccelKeys[2][2]=[["{ENTER}", $ENTERBUTTON], ["+{ENTER}", $SHIFT_ENTERDUMMY]]

GUISetAccelerators($AccelKeys)

GUISetState() ; display the GUI

Do

$msg = GUIGetMsg()

Select

Case $msg = $ENTERBUTTON

MsgBox(0, "You clicked on", "ENTER Button")

Case $msg = $SHIFT_ENTERDUMMY

MsgBox(0, "You clicked on", "Shift Enter Hotkey Dummy")

Case $msg = $GUI_EVENT_CLOSE

MsgBox(0, "You clicked on", "Close")

EndSelect

Until $msg = $GUI_EVENT_CLOSE

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Woah woah

Has no one seen this style?

$BS_DEFPUSHBUTTON

Creates a push button with a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely option, or default.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...