Jump to content
Sign in to follow this  
CodeMaster Rapture

GUI Event Mode and $GUI_EVENT_CLOSE issues...

Recommended Posts

CodeMaster Rapture

Greetings yet again,

I decided to try out the GUI Event Mode to save some CPU load and it has done wonders. Only having one problem. The X to close the GUI doesn't work. I dunno why, I mean, I get no compile errors or anything. Here is the code:

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

HotKeySet("{ESC}", "Do_Quit")

$Menu       = GuiCtrlCreateMenu ("Menu")
$MenuItem[1]    = GuiCtrlCreateMenuitem("About", $Menu)
$Separator1 = GuiCtrlCreateMenuitem("", $Menu)
$MenuItem[2]    = GuiCtrlCreateMenuitem("Exit", $Menu)

GUICtrlSetOnEvent( $MenuItem[1] ,   "Do_About")
GUICtrlSetOnEvent( $MenuItem[2] ,   "Do_Quit")
GUICtrlSetOnEvent( $GUI_EVENT_CLOSE ,   "Do_Quit")

Func Do_Quit()
    If (WinActive($Title)) Then Fade($Title,-1)

Of course I've stripped the non-important code, but I think the problem is with the SetOnEvent function. Maybe someone knows what's up.



Share this post

Link to post
Share on other sites

You should use the GUISetOnEvent() instead of the B]GUICtrlSetOnEvent()function for the close event, because the GUI is not a control, then it should work :whistle:

  • Like 1

Share this post

Link to post
Share on other sites
CodeMaster Rapture

Aaahhh, ok. Silly me.

Thanx a bunch. I was begginning to think I was crazy.


Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.