Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
dbigham
Posts: 496
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
Accepted Solution

SegmentedControl: Warning: Unable to show more than 4 allowed segments on the screen.

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. 

Please use plain text.
Developer
dbigham
Posts: 496
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: SegmentedControl: Warning: Unable to show more than 4 allowed segments on the screen.

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.

Please use plain text.