I would expect the following to leave Button1 off and button 2 on but … (build 2336)
local widget = require("widget") local button1 = widget.newSwitch { left = 5, top = 10, style = "radio", initialSwitchState = false, onPress = function () print("button1") end, } local button2 = widget.newSwitch { left = 5, top = 50, style = "radio", initialSwitchState = false, onPress = function () print("button2") end, } button2:setState( {isOn = true} ) button1:setState( {isOn = false} ) print("button1.isOn: ", button1.isOn) print("button2.isOn: ", button2.isOn)
however, visually and the output of this say:
button1.isOn: true
button2.isOn: false
removing the line: button1:setState( {isOn = false} )
and the results are as expected.