I have a button like this:
local function myHandler(event)
display.remove(myButton)
goNextScreen()
end
local myButton = widget.newButton {
x = 40,
y = 380,
width = 200,
label = "Go next screen!",
onRelease = myHandler
}
My button never gets removed. At first sight that is because you ask the button’s handler to remove the button that references it, but this problem will always exist (e.g. also if you remove it in the next screen).
Any clues? I’ve tried closures with the handler and the buttons and their functions in a function “makeButtons” as well.
Any thoughts greatly appreciated - this should be easy. What am I missing?
[import]uid: 5822 topic_id: 16010 reply_id: 316010[/import]