E1M1 Posted January 29, 2011 Share Posted January 29, 2011 (edited) I am trying to make script detect if input box is clicked, but I cant find out how. I have tried using WM_MOUSEFIRST and WM_NOTIFY, but they dont work. Also If GUIGetMsg() = $input Then MsgBox(0,0,"clicked") doesn't help me. $WM_MOUSEFIRST = 0x0200 $hGui = GUICreate("click on input", 75, 20) $input = GUICtrlCreateInput("click me", 0, 0, 75, 20) GUIRegisterMsg($WM_MOUSEFIRST, "WM_MOUSEFIRST") GUISetState() While True if GUIGetMsg() = -3 Then Exit WEnd Func WM_MOUSEFIRST($hWnd, $iMsg, $iWparam, $iLparam) #forceref $hWnd, $iMsg, $iWparam Local $hWndFrom, $tNMHDR $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Switch $hWndFrom Case $input MsgBox(0, 0, "clicked") EndSwitch Return EndFunc ;==>WM_NOTIFY Edited January 29, 2011 by E1M1 edited Link to comment Share on other sites More sharing options...
kylomas Posted January 29, 2011 Share Posted January 29, 2011 E1M1, Is the "primary" button x01 or x02? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
E1M1 Posted January 29, 2011 Author Share Posted January 29, 2011 Not exactly sure but I guess x01. How can this help? edited Link to comment Share on other sites More sharing options...
kylomas Posted January 29, 2011 Share Posted January 29, 2011 (edited) E1M1, You are registering message x02. If the primary mouse click generates x01 nothing will ever happen. Have you tried it with x01? kylomas edit: addition - guigetmsg has some symbolics defined for events, particularly $gui_event_primarydown also: you want to detect if the input area is clicked, regardless of whether or not it contains data? Edited January 29, 2011 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
UEZ Posted January 29, 2011 Share Posted January 29, 2011 Try this: $WM_MOUSEFIRST = 0x0200 $WM_SETCURSOR = 0x0020 $hGui = GUICreate("click on input", 75, 20) $input = GUICtrlCreateInput("click me", 0, 0, 75, 20) GUIRegisterMsg($WM_SETCURSOR, "WM_MOUSEFIRST") GUISetState() While True if GUIGetMsg() = -3 Then Exit WEnd Func WM_MOUSEFIRST($hWnd, $iMsg, $iWparam, $iLparam) #forceref $hWnd, $iMsg, $iWparam If BitAND($iLparam, 0x00010000) Then MsgBox(0, 0, "clicked") Return EndFunc Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
E1M1 Posted January 29, 2011 Author Share Posted January 29, 2011 (edited) Than you UEZ. How do I detect what control received that message? I tried following but it doesnt work. No compiler errors but program just crashes when it happens to receive that signal. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> $WM_MOUSEFIRST = 0x0200 ;~ $WM_SETCURSOR = 0x0020 $hGui = GUICreate("click on input", 750, 20) $input = GUICtrlCreateInput("click me", 0, 0, 75, 20) GUIRegisterMsg($WM_SETCURSOR, "WM_MOUSEFIRST") GUISetState() While True if GUIGetMsg() = -3 Then Exit WEnd Func WM_MOUSEFIRST($hWnd, $iMsg, $iWparam, $iLparam) #forceref $hWnd, $iMsg, $iWparam Local $hWndFrom, $iCode, $tNMHDR, $tEnLink, $cpMin, $cpMax, $tMsgFilter $tNMHDR = DllStructCreate($tagNMHDR, $iLparam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Switch $hWndFrom Case $input MsgBox(0,0,0) EndSwitch ;~ Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Edited January 29, 2011 by E1M1 edited Link to comment Share on other sites More sharing options...
UEZ Posted January 29, 2011 Share Posted January 29, 2011 By trying some Message Codes and see what happens when clicking into the input control but I don't know whether it is working properly for more complex GUIs, e.g. another input control. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
kylomas Posted January 29, 2011 Share Posted January 29, 2011 (edited) E1M1, Sorry, confused vl value for $wm_keyfirst. You asked for an expert therefore I'll stay out of it. kylomas you have to uncomment $wm_s4etcursor in your previous code. Edited January 29, 2011 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
kylomas Posted January 30, 2011 Share Posted January 30, 2011 (edited) E1M1, How about the @gui_ctrlhandle or @gui_ctrlid macros?kylomassorry, none worked, I promise I'll but out now.@UEZ - this is from the MS doc "WM_SETCURSOR MessageSent to a window if the mouse causes the cursor to move within a window and mouse input is not captured."What does "and mouse input is not captured" mean?kylomas Edited January 30, 2011 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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