I am trying to use the segment control and somethings are working fine. However a few comments and posssible bugs.
I have set the id=99, but in the event the id ==nil. {code follows from modified corona sample}
I would also like to be able to access the segmentcontrol table of segments, but this is returned as nil. Likewise I would like to be able to change the segment labels at run time as well as treat the segment table as a normal table determining total number of entries using #target.segments.Maybe also change the number of segments.
Ideally new and additional methods to access the table and make the required changes.
id bug follows
local function segmentedControlListener( event )
local target = event.target
print (target.id)—print nil here
statusText.text = "Segmented Control\nself.segmentNumber = " … target.segmentNumber
end
– Create a default segmented control (using widget.setTheme)
local segmentedControl = widget.newSegmentedControl {
left = 10,
top = 0,
segments = { “Corona”, “Widget”, “Demo” },
defaultSegment = 1,
id=99, – added a new id value [string I assume]
segmentWidth = 88,
onPress = segmentedControlListener
}