GUICtrlCreateInput onevent= enter
#1
Posted 16 May 2009 - 10:30 PM
I know on InputBox the user can enter text and press enter continue to the next step.
Is it possible to do the same when using the GUICtrlCreateInput?
Here's partial code:
;password
GuiCtrlCreateLabel("Enter your directory password (optional):", 10, 55, 325, 20)
$MyPassword = GUICtrlCreateInput("",10, 75, 350, 20, 0x00020) ;the 0x00020 creates the '*' while typing
GUICtrlSetState(-1, $GUI_FOCUS) ;set button to default so user can just hit enter to accept defaults
If $msg = $Save Then
$MyPassword = GUICtrlRead($MyPassword)
endif
Currently the user must click on the Save button.
Is there a way for the user to enter the password and press the enter key?
Thanks.
DNB
#2
Posted 16 May 2009 - 11:23 PM
Just pressing Enter when the input has focus will cause an event from the input, so this example might be what you need.I have a gui input box for password and wanted to see if the user can just press enter rather than clicking a button
I know on InputBox the user can enter text and press enter continue to the next step.
Is it possible to do the same when using the GUICtrlCreateInput?
Here's partial code:
;password
GuiCtrlCreateLabel("Enter your directory password (optional):", 10, 55, 325, 20)
$MyPassword = GUICtrlCreateInput("",10, 75, 350, 20, 0x00020) ;the 0x00020 creates the '*' while typing
GUICtrlSetState(-1, $GUI_FOCUS) ;set button to default so user can just hit enter to accept defaults
If $msg = $Save Then
$MyPassword = GUICtrlRead($MyPassword)
endif
Currently the user must click on the Save button.
Is there a way for the user to enter the password and press the enter key?
Thanks.
DNB
GUICreate("input with Enter") $ip1 = GUICtrlCreateInput("", 30, 40, 120, 22) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case - 3 Exit Case $ip1 MsgBox(262144, "ip1", "enter pressed") EndSwitch WEnd
- matwachich likes this
#3
Posted 17 May 2009 - 12:18 AM
Thank you. Sometimes it takes a second pair of eyes. --DNBJust pressing Enter when the input has focus will cause an event from the input, so this example might be what you need.
GUICreate("input with Enter") $ip1 = GUICtrlCreateInput("", 30, 40, 120, 22) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case - 3 Exit Case $ip1 MsgBox(262144, "ip1", "enter pressed") EndSwitch WEnd
#4
Posted 01 June 2009 - 10:28 PM
In fact ENter will only trigger an event when there has been some change to the input. If you just click in the input and press Enter you probably won't trigger an event. Here is one way round thatThank you. Sometimes it takes a second pair of eyes. --DNB
#include <GuiConstantsEx.au3> #include <windowsconstants.au3> $Gui = GUICreate("Edit Append Text", 400, 300) $Input1 = GUICtrlCreateInput("This is a test", 2, 2, 394, 26) $Ip2 = GUICtrlCreateInput("another one", 2, 35, 394, 26) $Dum = GUICtrlCreateDummy() Dim $accels[1][2] = [["{ENTER}", $Dum]] GUISetAccelerators($accels) GUISetState() ; GUIRegisterMsg($WM_COMMAND, "DB_WM_COMMAND");only used for EN_CHANGE so far GUICtrlSetData($Input1, "Append to the end?") ; Loop until user exits While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Input1 ConsoleWrite("edited" & @CRLF) Case $Dum If ControlGetFocus($Gui) = "Edit1" Then ConsoleWrite("Enter pressed in Edit1" & @CRLF) EndSwitch WEnd GUIDelete()
#5
Posted 02 June 2009 - 12:10 AM
#6
Posted 28 July 2009 - 01:43 PM
In fact ENter will only trigger an event when there has been some change to the input. If you just click in the input and press Enter you probably won't trigger an event. Here is one way round that
Plain Text#include <GuiConstantsEx.au3> #include <windowsconstants.au3> $Gui = GUICreate("Edit Append Text", 400, 300) $Input1 = GUICtrlCreateInput("This is a test", 2, 2, 394, 26) $Ip2 = GUICtrlCreateInput("another one", 2, 35, 394, 26) $Dum = GUICtrlCreateDummy() Dim $accels[1][2] = [["{ENTER}", $Dum]] GUISetAccelerators($accels) GUISetState() ; GUIRegisterMsg($WM_COMMAND, "DB_WM_COMMAND");only used for EN_CHANGE so far GUICtrlSetData($Input1, "Append to the end?") ; Loop until user exits While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Input1 ConsoleWrite("edited" & @CRLF) Case $Dum If ControlGetFocus($Gui) = "Edit1" Then ConsoleWrite("Enter pressed in Edit1" & @CRLF) EndSwitch WEnd GUIDelete()
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users





