Compile error

hi,

If I click on this program Btn2 x i have error. why?

Why function Btn2Click not see property Btn1.label?

local widget = require( "widget" )     local Btn1 = widget.newButton     Btn2Click = function( event )       Btn1.label="done"     end         local Btn2 = widget.newButton     {         label = "222",         onPress = Btn2Click,         shape="roundedRect",         width = 50,         height = 50,         left = 140,         top = 160     }                  Btn1     {         label = "111",         shape="roundedRect",         width = 50,         height = 50,         left = 140,         top = 60     }

Hi @podrurznik,

When you make a widget button, you need to pass the table of parameters to it as part of the creation, not sometime after. So basically, you’ve created “Btn2” correctly, but you can’t pass “nothing” to “Btn1” when you create it as a widget button.

Take care,

Brent

Hi @podrurznik,

When you make a widget button, you need to pass the table of parameters to it as part of the creation, not sometime after. So basically, you’ve created “Btn2” correctly, but you can’t pass “nothing” to “Btn1” when you create it as a widget button.

Take care,

Brent