astrax Posted March 26, 2009 Share Posted March 26, 2009 (edited) Hi, I have 2 input box on a gui and i wanted to be able to click on a specific one to clear out what ever txt in it. Can someone please help #include <GuiConstants.au3> $gui = GUICreate("test", 300, 100) $input1 = GUICtrlCreateInput("input test", 10, 10, 250, 30) $input2 = GUICtrlCreateInput("another input test", 10, 40, 250, 30) GUISetState() While 1 WEnd Edited March 26, 2009 by astrax Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 26, 2009 Moderators Share Posted March 26, 2009 astrax, I hope this does what you want:#include <GUIConstantsEx.au3> _Clear_Input() Func _Clear_Input() $hGUI = GUICreate("Test", 500, 500) $hInput_1 = GUICtrlCreateInput("Input_1 ", 10, 10, 200, 20) $hInput_2 = GUICtrlCreateInput("Input_2 ", 10, 80, 200, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $aInfo = GUIGetCursorInfo($hGUI) If $aInfo[2] Then If $aInfo[4] = $hInput_1 Then GUICtrlSetData($hInput_1, "") If $aInfo[4] = $hInput_2 Then GUICtrlSetData($hInput_2, "") EndIf WEnd EndFunc;==>_Clear_Input 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 Link to comment Share on other sites More sharing options...
astrax Posted March 26, 2009 Author Share Posted March 26, 2009 This is great!!!! Thank you so much. astrax, I hope this does what you want:#include <GUIConstantsEx.au3> _Clear_Input() Func _Clear_Input() $hGUI = GUICreate("Test", 500, 500) $hInput_1 = GUICtrlCreateInput("Input_1 ", 10, 10, 200, 20) $hInput_2 = GUICtrlCreateInput("Input_2 ", 10, 80, 200, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $aInfo = GUIGetCursorInfo($hGUI) If $aInfo[2] Then If $aInfo[4] = $hInput_1 Then GUICtrlSetData($hInput_1, "") If $aInfo[4] = $hInput_2 Then GUICtrlSetData($hInput_2, "") EndIf WEnd EndFunc;==>_Clear_Input M23 Link to comment Share on other sites More sharing options...
antonioj84 Posted May 11, 2017 Share Posted May 11, 2017 I know this is old however a better way would be GUICtrlSetState($Input1, $GUI_FOCUS) GUICtrlSetData($Input1, "") ;Reset input Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 11, 2017 Moderators Share Posted May 11, 2017 antonioj84, And how is that a better solution? If the user clicks on $hInput_2 how will your code clear it? The idea is to clear the input in which the user clicks - not just a specific one. 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 Link to comment Share on other sites More sharing options...
antonioj84 Posted May 11, 2017 Share Posted May 11, 2017 Case $Start ;******************************************************************Error Checking start**************************************** If GUICtrlRead($Input1) = "" Then MsgBox(0, "WarNing", "StoreNumber is blank", 3) ElseIf GUICtrlRead($Radio1) = $GUI_UNCHECKED And GUICtrlRead($Radio2) = $GUI_UNCHECKED Then MsgBox(0, "WarNing", "must select Tablet or Fixed POS", 3) ElseIf GUICtrlRead($hCombo) = "" Then MsgBox(0, "WarNing", "must Select register number", 3) ElseIf StringLeft($checknum, 1) <> 9 And BitAND(GUICtrlRead($idCheckbox), $GUI_CHECKED) And GUICtrlRead($Radio2) = $GUI_UNCHECKED Then ; check for training RIAB in position 2 check value store number if not start with 9 MsgBox(0, "error", "Training RIAB MUST START WITH 9") GUICtrlSetState($Input1, $GUI_FOCUS) GUICtrlSetData($Input1, "") ;Reset input ElseIf StringLeft($checknum, 1) = 9 And BitAND(GUICtrlRead($idCheckbox), $GUI_CHECKED) or BitAND(GUICtrlRead($idCheckbox), $GUI_UNCHECKED) And GUICtrlRead($Radio2) = $GUI_CHECKED Then MsgBox(0,"Warning"," tablet store number don't start with a 9") GUICtrlSetState($Input1, $GUI_FOCUS) GUICtrlSetData($Input1, "") ;Reset input ElseIf StringLeft($checknum, 1) = 9 And BitAND(GUICtrlRead($idCheckbox), $GUI_UNCHECKED) And GUICtrlRead($Radio1) = $GUI_CHECKED Then MsgBox(0,"Warning"," Live store number don't start with a 9") GUICtrlSetState($Input1, $GUI_FOCUS) GUICtrlSetData($Input1, "") ;Reset input here is a little snippet from my code that work for me, other option ;~ GUICtrlSetState($Input3, $GUI_ENABLE) , ;~ GUICtrlSetState($Input3, $GUI_DISABLE) 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