2) Press Alt+3. The notification for Button 1 is tiggered instead of Button 3. I assume that accelerator-keys (or whatever they are called) are not supported yet?

Also, pressing Esc (or Ctrl+Break) triggers the button with focus. This behavior can be very bad if you want a GUI to simulate MsgBox behavior where Esc/Ctrl+Break should invoke Close/Cancel... I've posted samples here where you can try pressing Esc or Ctrl+Break.

Share this post

Link to post

Share on other sites

Jon 775

Looking at the help/code it seems that GuiMsg(0) returns immediately and gives the last control played with (or 0), but what happens if other messages/controls are clicked in the time that the "Sleep(100)" happens, or during the time you process the message? You will miss events and things get out of sync.

With the correct notify mode and GuiMsg() don't you get a message each time a control is clicked anyhow without needing the whole Sleep() thing?

In fact even with GuiMsg() I'm starting to think there may be problems - it runs its own message loop but may miss events in the time you process its return result until the time you run GuiMsg() again.

Maybe this is why I get odd operation sometimes with scripts working for some people and not me...and then they suddenly start working... It all starts to make sense.

I'll have to think about a solution, but I'm thinking along the lines of a message queue that buffers events in the gui until they are read... Hmmmmmm

Share this post

Link to post

Share on other sites

Valik 467

Jon, GuiMsg() blocks like MessageBox or InputBox so it's not possible to use hotkeys or AdLib while it's running. You also don't get -3 (Or whatever the code is) from clicking the red close button with GuiMsg(), but you do with GuiMsg(0).

In regards to missing messages, I've found that anything above Sleep(50) creates a sluggish GUI, so that's usually what I use. I've never noticed a message being lost with that time.

I would like to see a queue, though. I think that might simplify things a bunch as it should allow moving to using only a single syntax for GuiMsg() and allow it to be non-blocking behind the scenes.

Share this post

Link to post

Share on other sites

therks 2

You also don't get -3 (Or whatever the code is) from clicking the red close button with GuiMsg(), but you do with GuiMsg(0).

Yeah, why is that? Is it intentional, or a bug? Cus it just seems to be that it would be better if it did return something.

See, I'm experimenting with the GUI stuff now, and I'm having a hard time making sense of it. Currently, I just want to have a window with 2 buttons. One that executes a function, and another that closes the program, but I still want the [x] to close the program as well. What seems to be happening though is that whenever I hit the [x], the window disappears, then reappears.