Hi,
I have an odd problem where disabling a widget button in its onEvent method seem to stop all other events from being called.
For example I have two buttons and one event handler. I can click button2 as much as i like and the label will change between the over and default colour (there is no onEvent here)
But if I click button1 and it calls letterTouch and therefore setEnabled(false), it changes to the ‘over’ text colour and then freezes.
I can’t then click button2 or button1 again
I have a Runtime:addEventListener(“enterFrame”, gameLoop) running and that still outputs some debug statements so the app hasnt fully crashed.
Does anybody have any ideas / point out something silly i’ve done / a workaround?
Thanks
local function letterTouch( event ) if ( event.phase == "began" ) then --code executed when the button is touched event.target:setEnabled(false) end return true end local button = widget.newButton { width = 20, height = 20, id = "let1", label = "1", labelColor = {default = {1,1,1}, over = {204/255,204/255,204/255}}, fontSize = 18, onEvent = letterTouch } button.x = 50 button.y = 50 local button2 = widget.newButton { width = 20, height = 20, id = "let2", label = "2", labelColor = {default = {1,1,1}, over = {204/255,204/255,204/255}}, fontSize = 18, } button2.x = 150 button2.y = 50
local gameLoop = function() print('running') end Runtime:addEventListener("enterFrame", gameLoop)