widget.newSegmentedControl position on screen

Hi,

I have a row array on the screen and a widget.newSegmentedControl with 2 segments, “yes” and “no”, for each row. When I position the segments to the left of the screen the buttons animate, but when I move them to the right of the screen, they don’t animate.

Does anyone know what would cause this issue? I’m using build 2013.1076.

Thanks.

Hi,

I should have also added that when the segment is moved to the right, the first part of the segment still works (“yes”), but the second segment (“no”) stops working.

Thanks.

Hi,

I should have also added that when the segment is moved to the right, the first part of the segment still works (“yes”), but the second segment (“no”) stops working.

Thanks.

In an application which defaults to landscape:

local testSwitch = widget.newSegmentedControl
{
   left = 0,
   top = 0,
   segments = { “Left”, “Right” },
   segmentWidth = 50,
   defaultSegment = sleepSegment,
   onPress = function (event)
                    local target = event.target
                    print( “Test Label is:”, target.segmentLabel )
                    return true
                end
}
local testGroup = display.newGroup()
testGroup:insert(testSwitch)
testGroup.x = 40

When the SegmentedControl is not in a group, it works.  When you put it in the group and set the testGroup.x to 0, it works.  As you increase testGroup.x in steps of 10, the “hot” areas of the two sides of the SegmentedControl shift until it no longer reacts at all.  If you don’t put it in the group, but adjust testSwitch.x, all works as it should.

In Portrait, it seems that both grouped and non-grouped SgementedControls work.

I’m now breaking my SegmentedControls out of my “fade” group and driving their individual x/y and alphas in parallel with the group.  It’s a pain, but it’s a workaround.

 

I found that by updating my build from 2013.1076 to 2013.1137, resolved the issue.

I’m running 2013.1137 (2013.6.7) and the issue is there.  It all depends on whether or not I put the Segmented Control in a group positioned anywhere except at 0,0.  If the group is not offset, the SegmentedControl works

I just implemented a workaround by not putting the SegementedControls in the group, but in a private table attached to the group. When I relocate the group or change its alpha, I fire an adjuster method that explicitly relocates the SegmentedControls or propagates the alpha to them.  Ugly, but it now works as it should and is transparent to the rest of my code that’s using my “fade” group.

The problems with segemented controls was fixed prior to 1136.  @ldeffenb, if you can create a small sample that demonstrates the problem is still happening, we would greatly appreciate you filing  a bug report using the “Report a Bug” feature above.  This may be a different issue than the one we fixed and the engineers need to see it happening.

Thanks

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.

Please put those into a zip file and use the “Report a bug” link above.  Engineers need the bug reports to manage their work and get the information to the right people.

In an application which defaults to landscape:

local testSwitch = widget.newSegmentedControl
{
   left = 0,
   top = 0,
   segments = { “Left”, “Right” },
   segmentWidth = 50,
   defaultSegment = sleepSegment,
   onPress = function (event)
                    local target = event.target
                    print( “Test Label is:”, target.segmentLabel )
                    return true
                end
}
local testGroup = display.newGroup()
testGroup:insert(testSwitch)
testGroup.x = 40

When the SegmentedControl is not in a group, it works.  When you put it in the group and set the testGroup.x to 0, it works.  As you increase testGroup.x in steps of 10, the “hot” areas of the two sides of the SegmentedControl shift until it no longer reacts at all.  If you don’t put it in the group, but adjust testSwitch.x, all works as it should.

In Portrait, it seems that both grouped and non-grouped SgementedControls work.

I’m now breaking my SegmentedControls out of my “fade” group and driving their individual x/y and alphas in parallel with the group.  It’s a pain, but it’s a workaround.

 

I found that by updating my build from 2013.1076 to 2013.1137, resolved the issue.

I’m running 2013.1137 (2013.6.7) and the issue is there.  It all depends on whether or not I put the Segmented Control in a group positioned anywhere except at 0,0.  If the group is not offset, the SegmentedControl works

I just implemented a workaround by not putting the SegementedControls in the group, but in a private table attached to the group. When I relocate the group or change its alpha, I fire an adjuster method that explicitly relocates the SegmentedControls or propagates the alpha to them.  Ugly, but it now works as it should and is transparent to the rest of my code that’s using my “fade” group.

The problems with segemented controls was fixed prior to 1136.  @ldeffenb, if you can create a small sample that demonstrates the problem is still happening, we would greatly appreciate you filing  a bug report using the “Report a Bug” feature above.  This may be a different issue than the one we fixed and the engineers need to see it happening.

Thanks

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.

Please put those into a zip file and use the “Report a bug” link above.  Engineers need the bug reports to manage their work and get the information to the right people.