Hi,
I’m looking at widget.newSwitch, “onoff” type…and seem to be encountering a variety of problems:
1. offDirection is ignored
2. default switch display is backwards.
…except at startup!
At startup, the circle is slid to the right for “initialSwitchState” = true or omitted,
and slid to the left for initialSwitchState = false.
3. Simulator is drastically different than Android, graphically:
On simulator, the switch is a white circle inside an oval.
When flipped to the right (for “off”, which *should* be “on” :),
a green shows in the oval (other than the circle).
On Android, the switch is either a blue rectangle with
“on” in it and on the right, or a dark grey rectangle with
“off” in it and on the left. The surrounding *rectangle*
is light gray.
BTW, **KUDOS** to CoronaLabs for putting “on”/“off” in the default graphic! Thanks!
I did notice that the left/right meaning problem was touched on here:
https://forums.coronalabs.com/topic/71338-newswitch-strange-behaviour/?hl=onoff
but it seemed to be forgotten as other issues were discussed.
Attached is a source for app that creates 9 switches … all possible variations of
default value = true / false / omitted, and direction for off = left / right / omitted.
At startup, note that the middle 3 switches are slid to the right, as they should be,
because they have the value “true” in the isOn field.
But, if you tap those three twice, you’ll see that slid-to-the-right is actually “off”,
indicating that the initial display doesn’t match the initial value (problem statement 2 above).
If you experiment, you’ll find that all 9 switches have “off” to the left (problem statement 1 above).
If you compare simulator to Android, you should see the drastic graphical difference.
I don’t mind minor differences (alignment, font size, etc.,), but this is beyond the pale
As you tap a switch, a message appears at the bottom, noting the new value for the switch,
so you can see activity (useful for the first tap to those middle three!)
thanks,
Stan