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
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Headers for SegmentedControl not working

I'm trying develop a screen with header section followed by a SegmentedControl and then a ListView.

 

If its just SegmentedControl and ListView,the screen comes up just fine.

 

However, with the 3 combined the header section is not displayinh.

 

My QML:

 

import bb.cascades 1.0

Page {
    id: screen1
    Container {
        id: screenContainer
        Container {
            id: headerContainer
            layout: StackLayout {
                layoutDirection: LayoutDirection.LeftToRight
            }
            preferredHeight: 40
            TextField {
                objectName: "inputText"
                text: "0"
                preferredWidth: 100
                preferredHeight: 40
            }
            Button {
                id: buttonID
                text: "inputButton"
                onClicked: {
                }
            }
        }
        SegmentedControl {
            id: segment
            objectName: "segment"
            Option {
                id: option1
                text: "1"
                description: "1"
                selected: true
            }
            Option {
                id: option2
                text: "2"
                description: "2"
            }
        }
        ListView {
            id: listView
            objectName: "listView"
            dataModel: GroupDataModel {
                grouping: ItemGrouping.None
                sortedAscending: false
            }
            listItemComponents: [
                ListItemComponent {
                    type: "item"                 
                }
            ]
        }
    }
}

 

Not sure if its an issue with the SDK, but is there any way that a screen can have a static header section while all other things continue?

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Headers for SegmentedControl not working

[ Edited ]

Try adding:

 

            layoutProperties: StackLayoutProperties {
                spaceQuota: 1
            }

 

to the ListView (and perhaps removing some of your preferredHeights)

 

Stuart

Developer
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: Headers for SegmentedControl not working

It does brings up the UI elements of header, but the height of textbox is not same as the button.

Is there any way, which would help in setting the dimension of component matching to that of its parent.

Like in this case if I can set a value, with which both the button and the textbox have height equivalent to the container.
BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Headers for SegmentedControl not working

The same trick would normally apply, but note:

 

https://developer.blackberry.com/cascades/reference/bb__cascades__textfield.html:

The height is fixed, so the properties Control::smileytongue:referredHeight, Control::minHeight and Control::maxHeight are not used.

 

https://developer.blackberry.com/cascades/reference/bb__cascades__button.html:

The height of the button is fixed, so the properties Control::smileytongue:referredHeight, Control::minHeight, and Control::maxHeight are not used.

 

You might find:

            TextField {
                objectName: "inputText"
                text: "0"
                preferredWidth: 100
                layoutProperties: StackLayoutProperties {
                    verticalAlignment: VerticalAlignment.Center
                }
            }

more to your liking.

 

Stuart