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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 27
Registered: ‎02-28-2013
My Device: device
My Carrier: device
Accepted Solution

Login Layout

Hi,

 

I have Developed a login screen in BB10 with  two label,textfield and a button.I was tried to align the button with Horizontal.Fill but it didn't align.The following code

===============

Page {
   Container {
        background:Color.create("#c0c0")
        topPadding: 20
        Container {
	        layout: StackLayout {
	            orientation: LayoutOrientation.LeftToRight
	        }
	        Label {
	            id: label
	            leftMargin: 10
	            text: "UserName"
                verticalAlignment: VerticalAlignment.Center
            }
	        TextField {
	            id:txtFrstName
	             preferredWidth:350
	             inputMode: TextFieldInputMode.Text
                hintText: "Enter Username"
            }
         }
        Container {
            topMargin: 30
            layout: StackLayout {
                orientation: LayoutOrientation.LeftToRight
            }
            Label {
                text: "Password"
                leftMargin: 10
                verticalAlignment: VerticalAlignment.Center
            }
            TextField {
                id: txtPassword
                preferredWidth: 350
                inputMode: TextFieldInputMode.Password
                leftMargin: 30
                hintText: "Enter Password"
            }
            
        }
        Container {
            topMargin: 30
            layout: StackLayout {}
            horizontalAlignment: HorizontalAlignment.Fill
            Button {
                text: "Login"
            }
            
        }
    }
}

 Kindly give me the solution.

 

Thanks & Regards,

Venkatesan.R

 

Developer
Posts: 74
Registered: ‎03-04-2012
My Device: developer
My Carrier: developer

Re: Login Layout

Hi Venkatesan.R

Add property preferredWidth in Button to specify the area in which ur button ll span if you want button to take full screen and if required give left and right padding

hope this will help you

Regards
Deepak Charya
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Login Layout

Change the container that the button is to be a LeftToRight orientation, and then make the button have spaceQuota: 1.0
Like all of my posts
Developer
Posts: 74
Registered: ‎03-04-2012
My Device: developer
My Carrier: developer

Re: Login Layout

To go with kylefowler suggestion use the following snippet 

 

Container {
topMargin: 30
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
leftPadding: 20
rightPadding: 20

Button {
layoutProperties: StackLayoutProperties {
spaceQuota: 1.0
}
horizontalAlignment: HorizontalAlignment.Fill
text: "Login"
}
}

Deepak Charya