06-26-2012 08:16 AM
I"ve defined a custom control:
import bb.cascades 1.0
Container {
property alias text: label.text
background: Color.create ("#262626")
bottomMargin: 30
layout: StackLayout {
layoutDirection: LayoutDirection.TopToBottom
}
Label {
id: label
text: "..."
textStyle {
base: SystemDefaults.TextStyles.TitleText
}
}
SegmentedControl {
Option {
id: option1
text: "A"
value: 5
selected: false
}
Option {
id: option2
text: "B"
value: 4
selected: false
}
Option {
id: option3
text: "C"
value: 3
selected: false
}
Option {
id: option4
text: "D"
value: 2
selected: false
}
Option {
id: option5
text: "E"
value: 1
selected: false
}
}
}
And have used it as such:
import bb.cascades 1.0
Container {
background: Color.create ("#262626")
layout: StackLayout {
layoutDirection: LayoutDirection.TopToBottom
leftPadding: 20
topPadding: 20
}
RatingControl {
text: "Eli"
}
RatingControl {
text: "Hazel"
}
}
But when I load the app, I get this error:
SegmentedControl: Warning: Unable to show more than 4 allowed segments on the screen.
Solved! Go to Solution.
06-26-2012 08:21 AM
Ah, somehow I missed the fact that only 4 of my 5 segments were being displayed in the UI preview, that should have been a hint. So this is just a warning.
Something else that was throwing me off was that my UI wasn't displaying when I actually loaded it in the simulator, but I think that's because I needed to have a Page at the top-level of main.qml, not a bare Container.