Jump to content

Passing data to a function defined in GUISetOnEvent


Recommended Posts

Is there a way to pass data to a function defined in GUISetOnEvent without using global vars? Seems to by a worth while feature if missing! e.g. GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents" [, $var])

HeidiRFind free applications, code examples and more on my site at:http://heidisdownloads.com/
Link to comment
Share on other sites

Is there a way to pass data to a function defined in GUISetOnEvent without using global vars? Seems to by a worth while feature if missing! e.g. GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents" [, $var])

No, but you can use function with Select for more cases.

When the words fail... music speaks.

Link to comment
Share on other sites

Is there a way to pass data to a function defined in GUISetOnEvent without using global vars? Seems to by a worth while feature if missing! e.g. GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents" [, $var])

I have a udf to allow variables to be passed to functions used by events and by hotkeys. It might be what you want. The limitations of the method are described in the first post of the link which also explains how to use it. If variables are used as parameters they have to be global though so if that is a problem it's not what you want.

You might wonder what the point of the udf is if it uses global variables, because you could just use those variables in the function. The answer is that with the udf the variables passed to a function can be different for different events. So you can have one function which is used by any number of events, and each event uses a different set of variables, or values, when it calls the function. This is particularly useful if you cannot know at design time what those variables will be and in these cases it simplifies the program a lot.

See the link in my signature.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

No, but you can use function with Select for more cases.

Thanks for the information. Function with Select sounds interesting but I have not been able to find any info on Select. Can you point me in the right direction?

HeidiRFind free applications, code examples and more on my site at:http://heidisdownloads.com/
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...