02-12-2013 05:52 PM
Hi everyone!
I have a problem if I add SegmentdControl to a Container with LayoutOrientation.LeftToRight with any control I have broken UI. For example:

import bb.cascades 1.0
Container {
layout: StackLayout { orientation: LayoutOrientation.LeftToRight }
SegmentedControl {
verticalAlignment: VerticalAlignment.Center
options: [
Option { text: qsTr("One"); }
,Option { text: qsTr("Two"); }
,Option { text: qsTr("Three"); }
,Option { text: qsTr("Four"); }
]
}
Button {
verticalAlignment: VerticalAlignment.Center
}
}
I think it's a bug.
but maybe somebody can help me to make workaround?
Thanks,
Maksim
Solved! Go to Solution.
02-12-2013 06:06 PM
I have tried with some ways to chagne the size of segmentcontrol, but all are not available. You have to let the segmentcontrol to occupy the whole width of the screen.
02-12-2013 06:35 PM
try to set spaceQuota in StackLayoutProperties for SC
layoutProperties: StackLayoutProperties {
spaceQuota: 1
}
https://developer.blackberry.com/cascades/referenc
You can also set maxWidth and minWidth to width of root Container using LayoutUpdateHandler.
02-13-2013 03:38 AM
02-13-2013 04:10 AM
Also I tried set min/max Width but it ignored so I set preferedWidth and then I can see:

Container {
SegmentedControl {
preferredWidth: 500
Option {
text: "one"
}
Option {
selected: true
text: "two"
}
Option {
text: "three"
}
Option {
text: "four"
}
}
}
02-13-2013 06:37 AM
Hi again.
Can you please tell me why you want Segmented Control and Button in the same line ? Please explain what do you want to achieve.
You set orientation: LayoutOrientation.LeftToRight so it means that controls are layouted from Left to Right. Change it to orientation: LayoutOrientation.TopToBottom then Button will be under SegmentedControl
02-13-2013 06:40 AM
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
SegmentedControl {
verticalAlignment: VerticalAlignment.Center
layoutProperties: StackLayoutProperties {
spaceQuota: 9
}
options: [
Option {
text: qsTr("One")
},
Option {
text: qsTr("Two")
},
Option {
text: qsTr("Three")
},
Option {
text: qsTr("Four")
}
]
}
Button {
verticalAlignment: VerticalAlignment.Center
layoutProperties: StackLayoutProperties {
spaceQuota: 1
}
}
}
02-13-2013 07:21 AM
igosoft thank you for quick reply!
No, LeftToRight it's correct. Our UI Disigner want to add a button here.
I tryed your code, and at first time this looks good, but if you change selected option then you can see incorrect position of selection area. Looks like the selection area size and/or positions is hardcoded ![]()
So main problem now it's incorrect size/position of selection area.
02-13-2013 07:33 AM
Please ask UI designer to change UX/UI of this screen. ![]()
02-13-2013 09:19 AM
Yes, I also met this kind of issue. I have to change the segmentcontrol into imagetogglebutton finally because the UI design can not be changed too much. You can have a try with ImageToggleButton