Code: Select all
ID=2
NewID = MakeButton(ID, #SIMPLEBUTTON, 100, 100, 100, 100, {OnMouseDown = Function() DebugPrint("mouse down") EndFunction})
DebugPrint(NewID)
WaitEvent()
I was having in my program a makebutton function, which sends, along the other data, ButtonID, which might be a fixed number, or a NIL.
The program at that point is not supposed to know whether there is a number or NIL, but it is supposed to catch it to Button.ButtonID variable.
Now problem is that if I am using:
Button.ButtonID = MakeButton(...
then if it is sent a fixed number, it fails, since it doesn't return the ButtonID:
Therefore, it would be good if MakeButton would return ButtonID in every case, regardless if it is NIL, userdata, or actual number.
This is also what you would expect from the description code in manual:
[id] = MakeButton(id, #SIMPLEBUTTON, x, y, width, height, t[, userdata])