Hi,
This is the first time I have used a segmented control or image sheets, so I am not sure if I am doing things correct. The following code works basically OK (registers presses correctly and 75% of graphics are in the correct place) except the middle segment is graphically always selected (selected sprite is always showing) and the text is blue. Any advice or help greatly appreciated.
[lua]
local function onPress( event )
local target = event.target
print( “Segment Label is:”, target.segmentLabel )
print( “Segment Number is:”, target.segmentNumber )
end
local options =
{
width = 190,
height = 61,
numFrames = 6,
sheetContentWidth = 570, --width of original 1x size of entire sheet
sheetContentHeight = 122 --height of original 1x size of entire sheet
}
local imageSheet = graphics.newImageSheet( “Assets/sb_SearchResults/filterBarSheet.png”, options )
local segmentedControl = widget.newSegmentedControl
{
left = 50,
top = header.height,
width = 190,
height = 61,
sheet = imageSheet,
leftSegmentFrame = 1,
leftSegmentSelectedFrame = 4,
middleSegmentFrame = 2,
middleSegmentSelectedFrame = 5,
rightSegmentFrame = 3,
rightSegmentSelectedFrame = 6,
--dividerFrame = 6,
segmentWidth = 190,
labelSize = 24,
segments = { “Common”, “Latin”, “Family” },
defaultSegment = 3,
onPress = onPress,
}
myGroup:insert(segmentedControl)
[/lua]