On-Off Switch - widget.newSwitch() doesn’t work when I “move”/slide 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 }
What build of Corona are you using? I just tested the widget sample project with the Android theme and it works fine. I can tap the switch to activate it, and I can also slide the handle left and right.
The current daily build is 2189. There have been significant bug fixes with widgets (and in general) since them. This is a Graphics 2.0 build which means you may need to make some code adjustments to use it. See: http://docs.coronalabs.com/guide/graphics/migration.html
What build of Corona are you using? I just tested the widget sample project with the Android theme and it works fine. I can tap the switch to activate it, and I can also slide the handle left and right.
The current daily build is 2189. There have been significant bug fixes with widgets (and in general) since them. This is a Graphics 2.0 build which means you may need to make some code adjustments to use it. See: http://docs.coronalabs.com/guide/graphics/migration.html