Sign in to follow this  
Followers 0
Shao

Guisetonevent Mode

2 posts in this topic

hello,

I have a problem with a gui.

I have a list of GUISetOnEvent($var, function()) used in my gui according this structure :

$WINgui = GUICreate("PROCESS CONTROLLER", 600, 660, (@DesktopWidth-600)/2, (@DesktopHeight-660)/2)

$FILEmenu = GUICtrlCreateMenu ("&Fichier")
$saveconfig = GUICtrlCreateMenuitem ("Sauvegarder la configuration",$FILEmenu)
ecc.

GUISetOnEvent ($closeitem, close())
GUISetOnEvent ($saveconfig , saveconfig ())
ecc.

GUISetState(@SW_SHOW)
    
While 1
Sleep(1000)
WEnd

this gui is launched from a tray icon.

I don't know why does the saveconfig() function is called and executed instead of the close() one.

I tried to invert the order of those two GUISetOnEvent and it looks to be the first GUISetOnEvent that is executed !

Can you tell me why ?

thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$WINgui = GUICreate("PROCESS CONTROLLER", 600, 660, (@DesktopWidth-600)/2, (@DesktopHeight-660)/2)

$FILEmenu = GUICtrlCreateMenu ("&Fichier")
$saveconfig = GUICtrlCreateMenuitem ("Sauvegarder la configuration",$FILEmenu)


GUICtrlSetOnEvent ($closeitem, 'close')
GUICtrlSetOnEvent ($saveconfig , 'saveconfig')


GUISetState(@SW_SHOW)
    
While 1
Sleep(1000)
WEnd

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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  
Followers 0