Jump to content

GuiGetMsg vs GuiSetOnEvent


Angel
 Share

Recommended Posts

Hi!

I've started playing around with the new GUI syntax and I really like it a lot. I seems easier to use than the old syntax.

So I'm converting some of my previous GUI's to the new syntax. In the old syntax I had a while loop around a GuiMsg, which seems now to have been replaced by GuiGetMsg.

However, on the new syntax I am trying to use the "events" as it seems a cleaner way of doing the work. But this made me wonder if we can use both methods at the same time or do we need to use either one or the other?

Also, it is a bit ackward that when using the event method we still need to add a while loop such as:

While 1

Sleep(10)

Wend

It is not a problem but it looks "bad". Maybe there should be a function GuiWaitClose or something like that.

Also I wonder if this loop lets the script go "idle" in the same manner that GuiGetMsg does. This is what the help file it says in the Remarks section of GuiGetMsg:

"This function automatically idles the CPU when required so that it can be safely used in tight loops without hogging all the CPU."

Cheers,

Angel

Link to comment
Share on other sites

  • Administrators

It will work fine without hogging the CPU. In fact it doesn't work as hard in the onevent mode so should be less CPU overall.

You can only be in one mode or the other, not both. The messages from the GUI would quickly get out of sync otherwise. When in the event mode GuiGetMsg will always return 0.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...