Jump to content

Guisetonevent Mode


Shao
 Share

Recommended Posts

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.

Link to comment
Share on other sites

  • Moderators

$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

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.

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...