Matthy Posted June 9, 2010 Share Posted June 9, 2010 Hey all, i have a GUI with inputs, and the purpose of those inputs is adding elements it works now by putting information in to the fields "GUICtrlCreateInput" fields and you can add them by using a add button "GUICtrlCreateButton" however its not that handy you keep mousing or tabbing to the add button and then shift tabbing back to the input field. is it possible to run the function that should be triggered by the button by enter if its in a input field? I thougth of using hotkeyset but that influences the whole envoinrent. is there a better solution?? thanks Matthy Link to comment Share on other sites More sharing options...
norax Posted June 9, 2010 Share Posted June 9, 2010 (edited) Hey all,i have a GUI with inputs, and the purpose of those inputs is adding elements it works now by putting information in to the fields "GUICtrlCreateInput" fields and you can add them by using a add button "GUICtrlCreateButton" however its not that handy you keep mousing or tabbing to the add button and then shift tabbing back to the input field.is it possible to run the function that should be triggered by the button by enter if its in a input field?I thougth of using hotkeyset but that influences the whole envoinrent.is there a better solution??thanksMatthy$BS_DEFPUSHBUTTON use this style when creating the button also make sure to #include <ButtonConstants.au3>this will make the button press when u hit enteredit: lol beat mel to this one so they get all complex and out do my answer =( Edited June 9, 2010 by norax Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 9, 2010 Moderators Share Posted June 9, 2010 Matthy, You mean like this: #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> $gui = GUICreate( "test", 200, 200) $inp = GUICtrlCreateInput("", 10, 10,100,20) $but = GUICtrlCreateButton("clear text", 120, 10) $hDummy = GUICtrlCreateDummy() GUICtrlSetState($but, $GUI_HIDE) GUISetState(@SW_SHOW) ; Set accelerator for Enter to action the Dummy code Dim $AccelKeys[1][2]=[["{ENTER}", $hDummy]] GUISetAccelerators($AccelKeys) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $hDummy ; Check input has focus If _WinAPI_GetFocus() = GUICtrlGetHandle($inp) Then $sText = GUICtrlRead($inp) MsgBox(0,"test", "You typed in " & $sText) GUICtrlSetState($but, $GUI_SHOW) EndIf Case $msg = $but GUICtrlSetData($inp, "") GUICtrlSetState($but, $GUI_HIDE) EndSelect WEnd GUIDelete() M23 GoogleDude 1 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 Link to comment Share on other sites More sharing options...
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