Sign in to follow this  
Followers 0
StAbb

GUI Button Press with {Enter} key

8 posts in this topic

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!

Share this post


Link to post
Share on other sites



This will give you an example

While 1
    Sleep(100)
    If _IsPressed("{Enter}") Then _Submit()
WEnd

Share this post


Link to post
Share on other sites

Thanks so much man, I forgot all about the _IsPressed function. Thanks again! Haha.

Share this post


Link to post
Share on other sites

Thanks so much man, I forgot all about the _IsPressed function. Thanks again! Haha.

Your Welcome muttley

Share this post


Link to post
Share on other sites

Your Welcome muttley

hi mate i have the same problem

but what does _Submit() then ?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

hi mate i have the same problem

but what does _Submit() then ?

@ Yucatan

it does exactly what it says, it sets the key {ENTER} that when pressed will _Sumbit all the data entered in the fields.

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0