Trivially easy. Make a new application and put this in as main.lua:
local widget = require(“widget”)
local workSwitch = widget.newSegmentedControl
{
left = 20,
top = 20,
segments = { “This”, “Works” },
segmentWidth = 50,
defaultSegment = sleepSegment,
onPress = function (event)
local target = event.target
print( “Works Label is:”, target.segmentLabel )
return true
end
}
workSwitch.x = 80
local noWorkSwitch = widget.newSegmentedControl
{
left = 20,
top = 60,
segments = { “This”, “Doesn’t” },
segmentWidth = 50,
defaultSegment = sleepSegment,
onPress = function (event)
local target = event.target
print( “Doesn’t Label is:”, target.segmentLabel )
return true
end
}
local testGroup = display.newGroup()
testGroup:insert(noWorkSwitch)
testGroup.x = 80
Change build.settings to reflect:
orientation = {
default = “landscape”,
supported = { “portrait”, “landscape” }
},
And you’ll see the issue.