SlimShady Posted October 10, 2004 Share Posted October 10, 2004 I tried it out and the function doesn't work. Even the example in the help file doesn't work: #include <GUIConstants.au3> Opt("GUICoordMode",2) Opt("GuiResizeMode", 1) $parent1 = GuiCreate("Parent1") $ok1 = GUICtrlCreateButton ("OK", 10, 30, 50) GUICtrlSetOnEvent(-1, "OKPressed") $cancel1 = GUICtrlCreateButton ( "Cancel", 0, -1) GUICtrlSetOnEvent(-1, "CancelPressed") GuiSetState(@SW_SHOW) Do $msg = GuiGetMsg(1) ; Get extra info in an array Until $msg[0] = $GUI_EVENT_CLOSE Func OKPressed() MsgBox(0, "OK Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE) EndFunc Func CancelPressed() MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE) EndFunc Link to comment Share on other sites More sharing options...
jpm Posted October 10, 2004 Share Posted October 10, 2004 I tried it out and the function doesn't work.Even the example in the help file doesn't work:#include <GUIConstants.au3> Opt("GUICoordMode",2) Opt("GuiResizeMode", 1) $parent1 = GuiCreate("Parent1") $ok1 = GUICtrlCreateButton ("OK", 10, 30, 50) GUICtrlSetOnEvent(-1, "OKPressed") $cancel1 = GUICtrlCreateButton ( "Cancel", 0, -1) GUICtrlSetOnEvent(-1, "CancelPressed") GuiSetState(@SW_SHOW) Do $msg = GuiGetMsg(1) ; Get extra info in an array Until $msg[0] = $GUI_EVENT_CLOSE Func OKPressed() MsgBox(0, "OK Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE) EndFunc Func CancelPressed() MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE) EndFunc<{POST_SNAPBACK}>You need now to add a Opt("GuiOnEvent"Mode, 1) to allow onevent to be called Link to comment Share on other sites More sharing options...
SlimShady Posted October 10, 2004 Author Share Posted October 10, 2004 Suggestion: add that to the help file, in the Remarks section of the function. Link to comment Share on other sites More sharing options...
Valik Posted October 10, 2004 Share Posted October 10, 2004 (edited) Suggestion: add that to the help file, in the Remarks section of the function.<{POST_SNAPBACK}>Suggestion: Follow the development threads if you intend to use the beta and you'll see that Jon has already stated he hasn't updated the docs yet with those changes.Edit: See. Edited October 10, 2004 by Valik Link to comment Share on other sites More sharing options...
Administrators Jon Posted October 10, 2004 Administrators Share Posted October 10, 2004 Suggestion: add that to the help file, in the Remarks section of the function.The example was written for a version before. The last unstable changed it slightly. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SlimShady Posted October 11, 2004 Author Share Posted October 11, 2004 Allright I added AutoItSetOption("GUIOnEventMode", 1) and the function works as expected but the rest of my script stops working. So I commented out all GUICtrlSetOnEvent() functions. My script was still not working. So I commented out AutoItSetOption("GUIOnEventMode", 1) and my script works fine now. I'm gonna try to make a sample script that shows this problem. Link to comment Share on other sites More sharing options...
this-is-me Posted October 11, 2004 Share Posted October 11, 2004 (edited) You can't have AutoItSetOption("GUIOnEventMode", 1) and a GuiGetMsg loop, I don't think. I believe it is one or the other. Edited October 11, 2004 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
SlimShady Posted October 11, 2004 Author Share Posted October 11, 2004 Oh didn't know that I made a test script that shows my problems exactly. Download below: Link to comment Share on other sites More sharing options...
Administrators Jon Posted October 11, 2004 Administrators Share Posted October 11, 2004 One or the other. Everything would get out of sync otherwise so the OnEvent mode turns off GuiGetMsg (it just returns 0 all the time). All other methods of having them both active that I thought about ended up with sync problems (GuiGetMsg not reacting to a close message quick enough and then Events still fireing afterwards that used OnEvent). Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SlimShady Posted October 11, 2004 Author Share Posted October 11, 2004 OK. Thanks for clearing that up. 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