MakeButton
Posted: Wed Aug 10, 2011 5:45 pm
Just an observation, I wasn't expecting this behaviour. Is this a bug?
MakeButton(#IMAGERESIZE, #SIMPLEBUTTON, 177,38,124,34, evtfunc, p_openimageResizeDisplay)
Look at the Userdata field, I am using a Function here. This will be called via msg.userdata in a Switch....Case conditional structure as expected.
Now take a look at this.
MakeButton(#IMAGERESIZE, #SIMPLEBUTTON, 177,38,124,34, evtfunc, p_openimageResizeDisplay(selected$[0])
This time I add parameters into the function set as Userdata.
Now when I run the program, the interpreter calls p_openimageResizeDisplay(selected$[0]) with parameters WHEN THE BUTTON IS CREATED and not as the result of callback.
Also try this:
MakeButton(#IMAGERESIZE, #SIMPLEBUTTON, 177,38,124,34, evtfunc, DebugPrint("here"))
The interpreter will again create the button and launch the userdata straightaway.
Therefore it is not currently possible to set a function that require parameters as userdata.
MakeButton(#IMAGERESIZE, #SIMPLEBUTTON, 177,38,124,34, evtfunc, p_openimageResizeDisplay)
Look at the Userdata field, I am using a Function here. This will be called via msg.userdata in a Switch....Case conditional structure as expected.
Now take a look at this.
MakeButton(#IMAGERESIZE, #SIMPLEBUTTON, 177,38,124,34, evtfunc, p_openimageResizeDisplay(selected$[0])
This time I add parameters into the function set as Userdata.
Now when I run the program, the interpreter calls p_openimageResizeDisplay(selected$[0]) with parameters WHEN THE BUTTON IS CREATED and not as the result of callback.
Also try this:
MakeButton(#IMAGERESIZE, #SIMPLEBUTTON, 177,38,124,34, evtfunc, DebugPrint("here"))
The interpreter will again create the button and launch the userdata straightaway.
Therefore it is not currently possible to set a function that require parameters as userdata.