Issue with Segmented Control

Allright, i got the project and i’ll post a bug on this.

Thanks!

alex

Any news on this?

I need to use this control for a deadline I have for a client, if it can’t be fixed I have to find a way around it (maybe just using buttons)

I would go for a button-based implementation for now. The fix will be there soon, i can’t estimate a precise date however.

Thanks,

alex

Hi corona staff,

I’m trying to add this to my current project but customizing it causes issues:

  1. The labelColor over value is still ignored. wasn’t this solved already?

  2. The select frame is taken from the middle of the select image instead of according to the frames defined.

Can you please have a look and fix this quickly?

Hi @rune7,

Please post your code so I can see how you’re setting this up. Also include the image sheet declaration part.

Thanks,

Brent

Hi Brent,

Its a basic copy paste from your sample. 

local function createSegmentControl(onSegmentPressCB, labels, selectedIndex, segmentWidth) -- Image sheet options and declaration local options = { frames = { { x=0, y=0, width=40, height=68 }, { x=40, y=0, width=40, height=68 }, { x=80, y=0, width=40, height=68 }, { x=120, y=0, width=40, height=68 }, { x=160, y=0, width=40, height=68 }, { x=200, y=0, width=40, height=68 }, { x=245, y=0, width=4, height=68 } }, sheetContentWidth = 250, sheetContentHeight = 68 } local segmentSheet = graphics.newImageSheet( consts.controlsDir.."segmentSheet.png", options ) -- Create a custom segmented control local segmentedControl = widget.newSegmentedControl { left = 0, top = 0, sheet = segmentSheet, leftSegmentFrame = 1, middleSegmentFrame = 2, rightSegmentFrame = 3, leftSegmentSelectedFrame = 4, middleSegmentSelectedFrame = 5, rightSegmentSelectedFrame = 6, segmentFrameWidth = 40, segmentFrameHeight = 68, dividerFrame = 7, dividerFrameWidth = 4, dividerFrameHeight = 68, segmentWidth = segmentWidth, segments = labels, defaultSegment = selectedIndex, labelSize = 24, labelFont = consts.fontName, labelColor = { default = consts.introGoColor, over = consts.darkBlueColor, }, onPress = onSegmentPressCB } return segmentedControl end

Hi @rune7

There are indeed some issues here. I’m looking into fixes now.

Thanks,

Brent

Hi Brent,

is there any update on the issues with segmented control? Our project progresses well and we really would like to use this control.

The bare minimum is simply to expose the label color value for the selected segment.

Thanks 

Adi

Hi Adi,

Can you specify the exact issues you’re encountering? Which build # of Corona are you using at the moment?

Brent

Its the same issues we discussed few posts above:

Hi corona staff,

 

I’m trying to add this to my current project but customizing it causes issues:

  1. The labelColor over value is still ignored. wasn’t this solved already?

  2. The select frame is taken from the middle of the select image instead of according to the frames defined.

Can you please have a look and fix this quickly?

I’ve also posted the code used to test it.

Hi @rune7,

Which build # are you testing with?

Brent

2692 still.

OK, please try a build more recent. I made fixes to the issues that you describe in a fairly recent build (of course, if you still find issues, let me know).

Brent

oh, thanks. will try them. there wasn’t anything in the build log so I assumed it was not handled.

Tested on the latest build. I can now change the selected segment label color which was our main problem. Thanks again for this quick response!

The selected segment image is still taken from the wrong coordinates, but we can workaround this by creating a more homogeneous image for all segments (currently there are gradients which change it from segment to segment).

Adi 

Hi corona staff,

I’m trying to add this to my current project but customizing it causes issues:

  1. The labelColor over value is still ignored. wasn’t this solved already?

  2. The select frame is taken from the middle of the select image instead of according to the frames defined.

Can you please have a look and fix this quickly?

Hi @rune7,

Please post your code so I can see how you’re setting this up. Also include the image sheet declaration part.

Thanks,

Brent

Hi Brent,

Its a basic copy paste from your sample. 

local function createSegmentControl(onSegmentPressCB, labels, selectedIndex, segmentWidth) -- Image sheet options and declaration local options = { frames = { { x=0, y=0, width=40, height=68 }, { x=40, y=0, width=40, height=68 }, { x=80, y=0, width=40, height=68 }, { x=120, y=0, width=40, height=68 }, { x=160, y=0, width=40, height=68 }, { x=200, y=0, width=40, height=68 }, { x=245, y=0, width=4, height=68 } }, sheetContentWidth = 250, sheetContentHeight = 68 } local segmentSheet = graphics.newImageSheet( consts.controlsDir.."segmentSheet.png", options ) -- Create a custom segmented control local segmentedControl = widget.newSegmentedControl { left = 0, top = 0, sheet = segmentSheet, leftSegmentFrame = 1, middleSegmentFrame = 2, rightSegmentFrame = 3, leftSegmentSelectedFrame = 4, middleSegmentSelectedFrame = 5, rightSegmentSelectedFrame = 6, segmentFrameWidth = 40, segmentFrameHeight = 68, dividerFrame = 7, dividerFrameWidth = 4, dividerFrameHeight = 68, segmentWidth = segmentWidth, segments = labels, defaultSegment = selectedIndex, labelSize = 24, labelFont = consts.fontName, labelColor = { default = consts.introGoColor, over = consts.darkBlueColor, }, onPress = onSegmentPressCB } return segmentedControl end

Hi @rune7

There are indeed some issues here. I’m looking into fixes now.

Thanks,

Brent

Hi Brent,

is there any update on the issues with segmented control? Our project progresses well and we really would like to use this control.

The bare minimum is simply to expose the label color value for the selected segment.

Thanks 

Adi

Hi Adi,

Can you specify the exact issues you’re encountering? Which build # of Corona are you using at the moment?

Brent