Inververs Posted February 11, 2010 Share Posted February 11, 2010 How to register the event when the Input control is pressed in my GUI? In EditConstants.aus no such Notifications const I want to use the input as a hyperlink label control is not suitable as should be possible to edit the text. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 11, 2010 Moderators Share Posted February 11, 2010 Odin,I have never found a way of registering a click on an input control. The best I have come up with is to use "Enter" to indicate that the data entry is complete - as you are probably using the keyboard to enter the data in the first place, it is not too much of a restriction: #include <GUIConstantsEx.au3> Main() Func _Main() $hGUI = GUICreate("Test", 500, 500) Local $hInput = GUICtrlCreateInput('', 10, 10, 200, 20) GUISetState() ; Set an accelerator key to mark the end of the data input Local $hDum = GUICtrlCreateDummy() Local $accels[1][2] = [["{ENTER}", $hDum]] GUISetAccelerators($accels) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hDum MsgBox(0,"Input Ready", GUICtrlRead($hInput)) EndSwitch WEnd EndFunc ;==>_MainI hope this helps.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...
Inververs Posted February 11, 2010 Author Share Posted February 11, 2010 Thank you, Melba23 But this is not what I need, just pressing the mouse button should trigger the event. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 11, 2010 Moderators Share Posted February 11, 2010 (edited) Odin,I say again:I have never found a way of registering a click on an input control.M23Edit: But someone else might. Edited February 11, 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 Link to comment Share on other sites More sharing options...
wraithdu Posted February 11, 2010 Share Posted February 11, 2010 (edited) This is actually pretty easy. There's two methods I can think of: 1) Monitor the EN_SETFOCUS notification, which is sent to the parent window via WM_COMMAND. So, GuiRegisterMsg($WM_COMMAND... However this will not work if the input control already has focus (or is the only control in the GUI). If you have more controls and focus is being moved to the input and you really only need this notification one time, then this is certainly viable and would be my first choice. 2) Check for the $GUI_EVENT_PRIMARYDOWN or $GUI_EVENT_PRIMARYUP event using GUIGetMessage in advanced mode or GUIOnEventMode with GUIGetCursorInfo to find out what control the mouse has clicked. Edited February 11, 2010 by wraithdu Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 11, 2010 Moderators Share Posted February 11, 2010 wraithdu, I like the second way - but it is a bit roundabout. Although you seem to be specialising in that sort of code lately! 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...
Inververs Posted February 11, 2010 Author Share Posted February 11, 2010 (edited) All thanks. I did so: #include <GUIConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 447, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 232, 184, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GUICtrlSetCursor (-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYUP $aMouse_Info=GUIGetCursorInfo ( $Form1 ) Switch $aMouse_Info[4] Case $Input1 MsgBox(0,0,"Click") Case Else EndSwitch EndSwitch WEnd Edited February 11, 2010 by Odin Link to comment Share on other sites More sharing options...
wraithdu Posted February 11, 2010 Share Posted February 11, 2010 Yeppers, that'll do it. @Melba23 Thanks 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