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
MakeButton
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
http://myevolve.wordpress.com
Re: MakeButton
Try this quick example:
This should work
Code: Select all
Function HandleLMB(msg)
; Execute your custom function
msg.userdata.func(msg.userdata.params[0])
EndFunction
...
my_userdata = { func = DebugPrint, params = { "HELLO!" } }
MakeButton( ...., { OnMouseDown = HandleLMB }, my_userdata)
...
----------------------------
[Allanon] Fabio Falcucci | GitHub (leaving) | Gitea (my new house) | My Patreon page | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub (leaving) | Gitea (my new house) | My Patreon page | ☆★ All my links ★☆
- airsoftsoftwair
- Posts: 5871
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: MakeButton
@djrikki: What you experience is completely normal behaviour and not a bug. Check the documentation on functions in the Hollywood doc.