Does MakeButton() have to return ID as a last thing?

Feature requests for future versions of Hollywood can be voiced here
Post Reply
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

Does MakeButton() have to return ID as a last thing?

Post by Bugala »

Is there any technical reason that MakeButton Returns the ID as a last thing, as in:

Code: Select all

ID = MakeButton(NIL, X, Y...)
Doesnt it anyway reserve the memoryspace as a first thing, hence it could return it as a first thing too?

My question is related to the situation where I would want to use this returned value already when declaring the button.

As in:

Code: Select all

IButtonD = MakeButton(Nil, X, Y, {MyFunc=Function() ButtonFunc(ButtonID) EndFunction) )
I know this is unconvential, and I do have a workaround for this, but I would rather if it could simply work with the before mentioned code to make the code much simpler and not rely on workaroundrefs.
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Does MakeButton() have to return ID as a last thing?

Post by airsoftsoftwair »

Bugala wrote: Fri Oct 10, 2025 9:17 pm My question is related to the situation where I would want to use this returned value already when declaring the button.

As in:

Code: Select all

IButtonD = MakeButton(Nil, X, Y, {MyFunc=Function() ButtonFunc(ButtonID) EndFunction) )
The ID of the button will be passed to your callback so you can just do the following to access it:

Code: Select all

ButtonID = MakeButton(Nil, X, Y, {MyFunc=Function(msg) ButtonFunc(msg.id) EndFunction})
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

Re: Does MakeButton() have to return ID as a last thing?

Post by Bugala »

Good point, forgot it does that.

Going to check if I can take advantage of that, since I have my own custom MakeButton function.
Post Reply