Jump to content
Sign in to follow this  
CodeMaster Rapture

GUI Event Mode and $GUI_EVENT_CLOSE issues...

Recommended Posts

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:

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...