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
Contributor
micksen
Posts: 17
Registered: ‎07-31-2013
My Device: Q10
Accepted Solution

Problem with Controls next to each other

Hi,

i have a problem with a laben and a toggle Button.

I want to show them next to each other but the label should be on the right side and the toggle button on the left side.

so when i turn my phone into landscape mode the space between them should be growing.

Here is my Code example but i doesn't work as i want it to. 

        Container {
            layout: StackLayout {
                orientation: LayoutOrientation.LeftToRight

            }
            Label {
                text: qsTr("Public")
                textStyle {
                    base: SystemDefaults.TextStyles.TitleText
                }
            }
            ToggleButton {
            	
            }

        }

 

Developer
sorout2009
Posts: 104
Registered: ‎08-23-2012
My Device: Blackberry Z10

Re: Problem with Controls next to each other

Your requirement is not clear.

Once clear the point what you exactly want.

It will help to resolve your problem.

Dharmender Singh
Contributor
micksen
Posts: 17
Registered: ‎07-31-2013
My Device: Q10

Re: Problem with Controls next to each other

Hi,

thanks for your reply.

I want to show a toggle button and a label in one row.

I want the label to be on the left side (border) of the display and the toggle button on the right side (border) of the display.

Even if I switch the phone from Portrait- to Landscape Mode the label and the button need to be on the left and right border of the display.

Hope you understand my problem.

Developer
sorout2009
Posts: 104
Registered: ‎08-23-2012
My Device: Blackberry Z10

Re: Problem with Controls next to each other

Use below code for your need

 

Container {
layout: DockLayout {

}
Container {
horizontalAlignment: HorizontalAlignment.Left
Label {
text: qsTr("Public")
textStyle {
base: SystemDefaults.TextStyles.TitleText
}
}
}
Container {
horizontalAlignment: HorizontalAlignment.Right
ToggleButton {

}
}
}

 

 

Press like if this solve your problem and mark as solved.

Dharmender Singh