Disable buttons help mee!!

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]

.isActive doesn’t works. :frowning:
any other ideas? [import]uid: 30837 topic_id: 13486 reply_id: 49561[/import]

+1 for wanting to know the answer to this. I can’t disable UI buttons either, and I can’t believe it’s not transparent for us to do so.

local levelBtn = ui.newButton{  
 defaultSrc = "image.png",  
 defaultX = 100,  
 defaultY = 37,  
 overSrc = "image.png",  
 overX = 100,  
 overY = 37,  
 onEvent = levelSelected,  
 }  

I want to be able to do something like this:

levelBtn.isActive = false

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]

I’m not using widgets, but for the UI class, I had to hack into ui.lua and do this:

local function newButtonHandler( self, event )  
  
--the following three lines were added  
 if self.isActive == false then  
 return;  
 end  
...  

I’m not sure why this isn’t included in the module to begin with. [import]uid: 52127 topic_id: 13486 reply_id: 49568[/import]