charvi Posted December 16, 2008 Posted December 16, 2008 Hi, Perhaps an easy one..... How can I make an input so that when the user hits the [Enter] key, the OK button is activated? expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <GuiEdit.au3> #include <GuiMenu.au3> #include <GuiToolBar.au3> #include <GuiComboBoxEx.au3> #include <Array.au3> #include <Constants.au3> #include <WinAPI.au3> #include <File.au3> #include <Misc.au3> #include <GDIPlus.au3> #include <Color.au3> #include <INet.au3> #include <Memory.au3> _Login_Password_() Func _Login_Password_() Local $h_Login_Password, $h_Login_Password_Win, $h_Login_Password_Label Local $h_Login_Password_Btn1, $h_Login_Password_Btn3, $h_Login_Password_Btn4 local $ah_Input[1] $h_Login_Password_Win = GUICreate("Login", 560, 216, -1, -1, $WS_DLGFRAME) $h_Login_Password_Label = GUICtrlCreateLabel("Password:", 20, 50) $ah_Input[0] = GUICtrlCreateInput("", 120, 50, 300, 20, $ES_PASSWORD, 0) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlSetColor(-1, 0x000000) $h_Login_Password_Btn3 = GUICtrlCreateButton("OK", 300, 150, 100, 30) $h_Login_Password_Btn4 = GUICtrlCreateButton("Cancel", 440, 150, 100, 30) GUICtrlSetState($h_Login_Password_Btn3, $GUI_FOCUS); the focus is on this button GUISetState() While 1 $i_Msg = GUIGetMsg() Switch $i_Msg Case $h_Login_Password_Btn3 MsgBox(0,"OK","The OK button is selected") ExitLoop Case $h_Login_Password_Btn4 Exit EndSwitch WEnd GUIDelete($h_Login_Password_Win) EndFunc
AoRaToS Posted December 16, 2008 Posted December 16, 2008 (edited) use $BS_DEFPUSHBUTTON as a style for the button, then you can make a function that is triggered by the push of that button.search it in the help file Edited December 16, 2008 by AoRaToS s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3
AdmiralAlkex Posted December 16, 2008 Posted December 16, 2008 One way to do it is to use the style $BS_DEFPUSHBUTTON on your "OK"-button, simply change $h_Login_Password_Btn3 = GUICtrlCreateButton("OK", 300, 150, 100, 30) to $h_Login_Password_Btn3 = GUICtrlCreateButton("OK", 300, 150, 100, 30, $BS_DEFPUSHBUTTON) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
charvi Posted December 16, 2008 Author Posted December 16, 2008 One way to do it is to use the style $BS_DEFPUSHBUTTON on your "OK"-button, simply change $h_Login_Password_Btn3 = GUICtrlCreateButton("OK", 300, 150, 100, 30) to $h_Login_Password_Btn3 = GUICtrlCreateButton("OK", 300, 150, 100, 30, $BS_DEFPUSHBUTTON)Perfect ! Thank you AoRaToS and AdmiralAlkex
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now