Administrators Jon Posted January 15, 2005 Administrators Share Posted January 15, 2005 If you write a big GUI that uses the GUIGetMsg/MessageLoop mode then you will probably end up with a huge select statement checking for various clicks and controls. It might be worth remembering that AutoIt checks each Case until it finds one that is true, so it is a good idea to put the most common messages right at the top. Even for large GUIs it will be so fast that you may not notice anyway, but I thought it was worth mentioning (maybe on slow PCs or when the system is under strain already). The most common message will be 0, followed by $GUI_EVENT_MOUSEMOVE, so if you put a test for those at the top of your Select statement (even if you don't do anything with the mouse) then you will avoid having to check all your controls each loop for worthless messages. While 1 $msg = GUIGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $GUI_EVENT_MOUSEMOVE ContinueLoop Case $msg = $mycontrol ... ... EndSelect WEnd 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...
DirtyBanditos Posted January 15, 2005 Share Posted January 15, 2005 If you write a big GUI that uses the GUIGetMsg/MessageLoop mode then you will probably end up with a huge select statement checking for various clicks and controls. It might be worth remembering that AutoIt checks each Case until it finds one that is true, so it is a good idea to put the most common messages right at the top. Even for large GUIs it will be so fast that you may not notice anyway, but I thought it was worth mentioning (maybe on slow PCs or when the system is under strain already).The most common message will be 0, followed by $GUI_EVENT_MOUSEMOVE, so if you put a test for those at the top of your Select statement (even if you don't do anything with the mouse) then you will avoid having to check all your controls each loop for worthless messages.While 1 $msg = GUIGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $GUI_EVENT_MOUSEMOVE ContinueLoop Case $msg = $mycontrol ... ... EndSelect WEnd<{POST_SNAPBACK}> Thx Jon i test it on my big Gui ,great idea! Link to comment Share on other sites More sharing options...
Wolvereness Posted January 16, 2005 Share Posted January 16, 2005 On this note I put Case $msg <= 0 right after the Case $GUI_EVENT_CLOSE = $msg Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote] 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