Jump to content

GuiCtrlSetOnEvent sent parameters?


Recommended Posts

I have a function that generates a window based on the array I want to send it. I want to click a button and have it send the function a parameter (the array) and the window will be created. However, with GuiCtrlSetOnEvent you just specify the name of the function. ie:

GuiCtrlSetOnEvent($buttonOk, "startTest")

Func startTest($testName)  ;<-- how do I send this using the $buttonOk button?
    ;do something
EndFunc
Link to comment
Share on other sites

I have a function that generates a window based on the array I want to send it. I want to click a button and have it send the function a parameter (the array) and the window will be created. However, with GuiCtrlSetOnEvent you just specify the name of the function. ie:

GuiCtrlSetOnEvent($buttonOk, "startTest")

Func startTest($testName)  ;<-- how do I send this using the $buttonOk button?
    ;do something
EndFunc

<{POST_SNAPBACK}>

You need to define $testName as a global variable at the begining of your script. :whistle:
Link to comment
Share on other sites

You need to define $testName as a global variable at the beginning of your script. :whistle:

<{POST_SNAPBACK}>

I will have many different names that can be sent, so the window is generated on the fly. My intention is that depending on what button is pressed, a value is sent, then the window made based on that value. Otherwise, I might just have to make a function for each button? That would be wasteful, because I have many, many buttons....
Link to comment
Share on other sites

I will have many different names that can be sent, so the window is generated on the fly. My intention is that depending on what button is pressed, a value is sent, then the window made based on that value. Otherwise, I might just have to make a function for each button? That would be wasteful, because I have many, many buttons....

<{POST_SNAPBACK}>

And what about @GUI_CTRLID (@GUI_CtrlId --> Last click GUI Control identifier)

This is in Helpfile in the example for GUICtrlSetOnEvent ...

This means: One function and Select case statement by @GUI_CTRLID for every control (button).

Link to comment
Share on other sites

And what about @GUI_CTRLID (@GUI_CtrlId --> Last click GUI Control identifier)

This is in Helpfile in the example for GUICtrlSetOnEvent ...

This means: One function and Select case statement by @GUI_CTRLID for every control (button).

<{POST_SNAPBACK}>

Thank you!!! I'm not sure how I missed that. I think I just looked through the actual documentation and not the examples. Thanks!
Link to comment
Share on other sites

I don't know how to give more info. it is describe in the remark :">

Remarks

OnEvent functions are only called when the option GUIOnEventMode is set to 1 - when in this mode GUIGetMsg is NOT used at all.

Within the called user function the control identifier can be retrieved with @GUI_CTRLID.

If needed the windows handle and the control handle can be retrieved with @GUI_WINHANDLE or @GUI_CTRLHANDLE.

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