timmy2 Posted November 27, 2018 Share Posted November 27, 2018 I have the impression that the traditional method for processing responses to a GUI is to assign variables to each GUICreateButton (or Pic) and then use Switch/Case/Endswitch to detect when any Control is clicked. In the tutorials I've seen about Koda it appears to use this method, too. While 1 Global $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Pic2 Call("verizon") Case $Pic3 Call("skype") Case $PicExit Exit EndSwitch WEnd But in a few examples I've seen a script use a different method. The script always includes the following option near the top: Opt("GUIOnEventMode", 1) ...and then, later, after creating each Control for the GUI, there's the function, GUICtrlSetOnEvent. In these cases a very simple While/WEnd loop is used to wait for the user to respond. I happened to employ this second method in a recent script where I used "canned" controls (checkbox and buttons). Later in the same script I used the GuiCreatePic and Switch/Case/EndSwitch method because my GUI was all custom images. (I'm not sure if that's necessary, but it's what I've deduced.) The second GUI failed to respond to any mouse clicks, but eventually I figured out the cause was the GUIOnEvenMode being enabled at the top of the script. This is when I realized I don't understand the reasoning behind choosing between these two methods. And I'm having no luck phrasing an appropriate search criterion. Is there an overview somewhere that explains the two methods and -- most importantly -- describes when each is appropriate? Link to comment Share on other sites More sharing options...
TheXman Posted November 27, 2018 Share Posted November 27, 2018 (edited) I guess your search didn't include the HELP file. It even goes so far as to suggest when one would be better than the other. https://www.autoitscript.com/autoit3/docs/guiref/GUIRef.htm Edited November 27, 2018 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
timmy2 Posted November 27, 2018 Author Share Posted November 27, 2018 Thank you for pointing the way, though you guessed wrong. I did indeed search the HELP file but in my case the results were a haystack. I should've been more persistent and at least looked at every occurrence of "GUI Reference..." Link to comment Share on other sites More sharing options...
Developers Jos Posted November 27, 2018 Developers Share Posted November 27, 2018 2 minutes ago, timmy2 said: I did indeed search the HELP file but in my case the results were a haystack. Not really when you simply use the TOC, select GUI Reference and then GUI Concept. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
TheXman Posted November 27, 2018 Share Posted November 27, 2018 1 hour ago, timmy2 said: This is when I realized I don't understand the reasoning behind choosing between these two methods. And I'm having no luck phrasing an appropriate search criterion. Is there an overview somewhere that explains the two methods and -- most importantly -- describes when each is appropriate? Your question was about event modes not controls. Why would you search for GUI create when you want to know about GUI event modes. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
timmy2 Posted November 27, 2018 Author Share Posted November 27, 2018 1 hour ago, TheXman said: Your question was about event modes not controls. Why would you search for GUI create when you want to know about GUI event modes. How right you are, @TheXman, if only I had started out knowing the subject is "event modes" instead of "controls". People like me should not be allowed to ask questions until they know such everyday terminology. GUICreate was the first function that both methods have in common, and when one is grasping for a term to start with it was reasonable if futile starting point. Link to comment Share on other sites More sharing options...
timmy2 Posted November 27, 2018 Author Share Posted November 27, 2018 1 hour ago, Jos said: Not really when you simply use the TOC, select GUI Reference and then GUI Concept. Jos @jos, in this case the TOC would have been the best entry point. Not to excuse myself, but I'm just so accustomed to searching the forums and the HELP Index, then following the breadcrumbs. This lesson learned. (in which case I always ask myself, "How many more are there?" ) Link to comment Share on other sites More sharing options...
timmy2 Posted November 27, 2018 Author Share Posted November 27, 2018 Can someone close this thread before I suffer any more embarrassment? 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