I am using the switch widget for the first time and it does not display any text.
I thought that it would use the “id” as the text string to display
I’ve tried adding a .label to the creation options also setText() and setLabel() APIs none of which work.
Are we supposed to add a separate text widget to match or am I missing something?
Thanks for the help.
Switches don’t support text “out of the box”. The “id” field is just an internal id you can set on your widget. It’s use is to enable handling multiple widget events from a single listener function for instance, which you can then identify using event.target.id for example.
If you want to overlay text on a switch, you can create an object via display.newText and insert it into the switch via:
mySwitch:insert(textObjectHere)
Hope this helps