onRelease button

I have one button, which i click several time and per each click it should behave differently.

So i change it’s id many times , but i am not able to change the function it calls many time. 

Is there any way to achieve this please?
 

local mybutton=nil local function new\_release\_mybutton( event) -- body print("button clicked 2nd time, doesnt get called!") end local function release\_mybutton( event) -- body print("button clicked!") --change button id if mybutton.id=="mybuttonid" then mybutton.id="new\_mybuttonid" mybutton.onRelease=new\_release\_mybutton end end --create button mybutton=widget.newButton { id = "mybuttonid", left=380, top=500, defaultFile = "mybtn.png", onRelease=release\_mybutton } mybutton.width=200 mybutton.height=100

I don’t believe you can change your event handler that way.  I don’t think that .onRelease is a value that the widget looks at.  There are no guarantees that any constructor will become an attribute of the object.

Rob

I don’t believe you can change your event handler that way.  I don’t think that .onRelease is a value that the widget looks at.  There are no guarantees that any constructor will become an attribute of the object.

Rob