Reputation: 828
On-Off Switch - widget.newSwitch() doesn't work when I "move" the switch, it works only when I press.
I've tried setting "onEvent" but looks like it's completely ignored as nothing happens.
local widget = require( "widget" )
-- Handle press events for the checkbox
local function onSwitchPress( event )
local switch = event.target
print( "Switch with ID '"..switch.id.."' is on: "..tostring(switch.isOn) )
end
-- Create the widget
local onOffSwitch = widget.newSwitch
{
left = 250,
top = 200,
style = "onOff",
id = "onOffSwitch",
onPress = onSwitchPress
}
Upvotes: 0
Views: 232