lxxl Posted March 26, 2010 Posted March 26, 2010 Hi Guys, it is so simple, but i can't figure out this :DD $Input5 = GUICtrlCreateInput("", 8, 312, 121, 21) GUICtrlSetTip(-1, "Gime some") $Label8 = GUICtrlCreateLabel("test input", 8, 336, 116, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Button5 = GUICtrlCreateButton("Check", 136, 312, 65, 25, BitOR($BS_NOTIFY,$WS_TABSTOP,$WS_VISIBLE,$WS_CHILD)) any ideas how do the trick with enter to go, i mean after input some stuff in input field i want to hit enter to 'check' offcorse i can do TAB-enter or use mouse .. but its will be nice if after inpus some and hit enter its will go forward Thx and regards
Moderators Melba23 Posted March 26, 2010 Moderators Posted March 26, 2010 lxxl,I am not too sure what exactly you want to do, so this might be wide of the mark. If you want something to happen when you press "Enter" after entering something in an Input, you can do it with an Accelerator key like this:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hInput = GUICtrlCreateInput("", 10, 10, 480, 20) $hLabel = GUICtrlCreateLabel("", 10, 50, 480, 20) $hDummy = GUICtrlCreateDummy() GUISetState() ; Set accelerator for Enter to action the Dummy code Dim $AccelKeys[1][2]=[["{ENTER}", $hDummy]] GUISetAccelerators($AccelKeys) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hDummy GUICtrlSetData($hLabel, GUICtrlRead($hInput)) EndSwitch WEndNow pressing "Enter" will run the code for the Dummy control Case in the GUIGetMsg loop.I hope that is what you wanted. If not, explain again! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
KaFu Posted March 26, 2010 Posted March 26, 2010 If you want something to happen when you press "Enter" after entering something in an Input, you can do it with an Accelerator key like this: Started before, but had a meeting ... expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate(" My GUI", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45) $dummy_input_start = GUICtrlCreateDummy() $input1 = GUICtrlCreateInput("", 10, 5, 300, 20) $input2 = GUICtrlCreateInput("", 10, 35, 300, 20) $dummy_input_end = GUICtrlCreateDummy() $dummy_input_trigger = GUICtrlCreateDummy() Global $iActiveInput $btn = GUICtrlCreateButton("Exit", 40, 75, 60, 20) Dim $AccelKeys[1][2] = [["{ENTER}", $dummy_input_trigger]] GUISetAccelerators($AccelKeys) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GUICtrlSetState($input1,$GUI_FOCUS) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn ExitLoop EndSelect WEnd Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) $hCtrl = $lParam if $nID > $dummy_input_start and $nID < $dummy_input_end then if $nNotifyCode = 256 then $iActiveInput = $nID endif if $nID = $dummy_input_trigger Then Switch $iActiveInput Case $dummy_input_end -1 GUICtrlSetState($dummy_input_start+1,$GUI_FOCUS) ControlSend($hGUI,"",$dummy_input_start+1,"{END}") Case Else GUICtrlSetState($iActiveInput+1,$GUI_FOCUS) ControlSend($hGUI,"",$iActiveInput+1,"{END}") EndSwitch endif Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_COMMAND OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Moderators Melba23 Posted March 26, 2010 Moderators Posted March 26, 2010 (edited) KaFu,Very nice - and I think you understood better than I did! However, I will raise you with this modified version:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $iActiveInput $hGUI = GUICreate(" My GUI", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45) $input1 = GUICtrlCreateInput("", 10, 5, 300, 20) $input2 = GUICtrlCreateInput("", 10, 35, 300, 20) $dummy_input_trigger = GUICtrlCreateDummy() $btn_1 = GUICtrlCreateButton("Exit", 40, 75, 60, 20) $btn_2 = GUICtrlCreateButton("Log In", 140, 75, 60, 20) $dummy_log_in = GUICtrlCreateDummy() Dim $AccelKeys[1][2] = [["{ENTER}", $dummy_input_trigger]] GUISetAccelerators($AccelKeys) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GUICtrlSetState($input1, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $btn_1 ExitLoop Case $btn_2, $dummy_log_in MsgBox(0, "", "Logging in") GUICtrlSetState($input1, $GUI_FOCUS) GUICtrlSetData($input1, "") GUICtrlSetData($input2, "") EndSwitch WEnd Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) $hCtrl = $lParam If $nID = $input1 Or $nID = $input2 Then If $nNotifyCode = 256 Then $iActiveInput = $nID EndIf If $nID = $dummy_input_trigger Then Switch $iActiveInput Case $input2 GUICtrlSendToDummy($dummy_log_in) Case Else GUICtrlSetState($input2, $GUI_FOCUS) GUICtrlSetData($input2, "") EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_COMMANDNow pressing Enter on the second input logs in! M23Edit: Typnig! Edited March 26, 2010 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
lxxl Posted March 29, 2010 Author Posted March 29, 2010 ha many thx guys !! as always great help ! thx
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