MakeButton #SIMPLEBUTTON Vacant ID is userdata: 000FE...

Find quick help here to get you started with Hollywood
Post Reply
Bugala
Posts: 689
Joined: Sun Feb 14, 2010 8:11 pm

MakeButton #SIMPLEBUTTON Vacant ID is userdata: 000FE...

Post by Bugala » Wed Jun 13, 2018 10:39 pm

I am using:

Code: Select all

ID = MakeButton(Nil, #SIMPLEBUTTON, 10, 10, 100, 100, {OnMouseOver=DebugPrint})
DebugPrint(id)
And instead of this resulting in some clear number like "0" or "1" it results in "UserData: 0000000002ECF490"

Is this a bug or supposed to be this way? For what I had done was to store several simplebutton IDs to a table, and then i meant to DeleteButton with all those IDs, but now i cant do that since Deletebutton doesnt accept UserData: 000... as argument.

Bugala
Posts: 689
Joined: Sun Feb 14, 2010 8:11 pm

Re: MakeButton #SIMPLEBUTTON Vacant ID is userdata: 000FE...

Post by Bugala » Wed Jun 13, 2018 10:44 pm

Found from manual about this Autoselection that it is not supposed to be a number but it is supposed to be something like that. Very clever system by the way to be able to use both hardfixed numbers and vacant numbers together.

But so how can i then use these vacant created IDs at for example DeleteButton? Since it dont seem to accept them at their facevalue.

User avatar
jPV
Posts: 142
Joined: Sat Mar 26, 2016 11:44 am
Location: RNO
Contact:

Re: MakeButton #SIMPLEBUTTON Vacant ID is userdata: 000FE...

Post by jPV » Thu Jun 14, 2018 7:30 am

It should work, but are you sure you gave correct userdata to the DeleteButton? For example that "OnMouseOver=DebugPrint" in your example prints the message userdata, not the button id userdata.

Maybe this example would make things more clear to think:

Code: Select all

ids={}
for local i=0 to 5
    ids[i]=MakeButton(Nil, #SIMPLEBUTTON, 21*i, 20, 20, 20, {OnMouseOver=Function(msg) DebugPrint(msg.action, msg.id, msg.X) EndFunction})
    DebugPrint(ids[i])
    Box(21*i, 20, 20, 20, #RED)
Next

Function p_Mousebutton()
    If ListItems(ids)>0
        DebugPrint("Removing button functionality...")
        For Local i=0 To 5
            DeleteButton(ids[i])
        Next
        ids={}
    EndIf
EndFunction

InstallEventHandler({OnMouseDown=p_Mousebutton})

Repeat
    WaitEvent
Forever

Bugala
Posts: 689
Joined: Sun Feb 14, 2010 8:11 pm

Re: MakeButton #SIMPLEBUTTON Vacant ID is userdata: 000FE...

Post by Bugala » Thu Jun 14, 2018 1:17 pm

hmm. You are right, I added one more line:

Code: Select all

ID = MakeButton(Nil, #SIMPLEBUTTON, 10, 10, 100, 100, {OnMouseOver=DebugPrint})
DebugPrint(id)
DeleteButton(id)
And it does work.

Must be something else that failed in my original program then. I already fixed it to work different way, so cant check it out anymore. But I do think i made sure that it was userdata thing right before using the deletebutton, but maybe i was deleting it twice then or something.

Post Reply