Hi everyone, i need to disable some widget.buttons on press, please can you help me to do that??
local widget = require("widget")
local myGroup = display.newGroup()
local button
local b = function()
print("bb")
--HERE I WANT TO DISABLE myButton
--myButton.disablesomething!!!!!!!!
local a = function()
--HERE I WANT TO REABLE myButton
--myButton.re-able-me!!!!!
print("aa")
end
button = widget.newButton{
x = 100,
y = 100,
id = 1,
label="aaa " ,
onRelease = a
}
myGroup:insert( button.view )
end
myButton = widget.newButton{
x = 100,
y = 200,
id = 1,
label="aaa " ,
onRelease = b
}
myGroup:insert( myButton.view )
Hope you understand the problem.
Help me fix it!! [import]uid: 30837 topic_id: 13486 reply_id: 313486[/import]
try using .isActive = false for your button when you need to disable it
and
.isActive = true to re-able it [import]uid: 16142 topic_id: 13486 reply_id: 49501[/import]
so that the button does not receive touch events. This functionality is needed all the time, for example to display levels that are not yet unlocked. [import]uid: 52127 topic_id: 13486 reply_id: 49564[/import]