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: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Container border

I cannot seem to find how to use borders for containers.

I want to group certain items on a preference page, and a container with some borders would be nice.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Container border

No borders, so you have to handle that some other way.

Options include double-nesting Containers, with varying background colors (for a crude border effect), and using 9-slice images as backgrounds, with the appropriate border design, so they scale nicely.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 1,632
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Container border

I have Listview and want to add a border too.  looks out of place without a border.

wish container can accept border like background

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Container border

smiley, it's pretty easy to use the background property to do a border. Backgrounds can be colors or images, via https://developer.blackberry.com/cascades/reference/bb__cascades__imagepaint.html . Just define a proper 9-slice image and you'll get way nicer borders than whatever API they'd provide if they supported borders directly with an API (e.g. simple flat colors with some line width, "raised", "grooved" and all that stuff).

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Container border

Peter is right, and unlike BBOS, nesting Containers (managers) doesnt create a huge performance bottleneck, so its easy to get flat colored borders that way. I'd go with nine-slice though
Like all of my posts
Highlighted
Developer
Posts: 1,632
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Container border


peter9477 wrote:
smiley, it's pretty easy to use the background property to do a border. Backgrounds can be colors or images, via https://developer.blackberry.com/cascades/reference/bb__cascades__imagepaint.html . Just define a proper 9-slice image and you'll get way nicer borders than whatever API they'd provide if they supported borders directly with an API (e.g. simple flat colors with some line width, "raised", "grooved" and all that stuff).

I already have a background but what I wanted is just a simple frame around the ListView object.

 

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

Re: Container border

did any one found how easily can have border?

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Container border


mbasheerk wrote:

did any one found how easily can have border?


there is no new way to do that, you have to stack two containers with a small padding and set a background color on the outer one.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Container border

Nothing new. Available options are container inside of another container or using a 9-patch image:

 

Container *selectionContainer = Container::create()
    .layout(DockLayout::create())
    .add(contentContainer)
    .add(borderImageView_ = ImageView::create("asset:///images/other/selectedControlBorder.amd")
    .visible(false)
    .vertical(VerticalAlignment::Fill)
    .horizontal(HorizontalAlignment::Fill));

 ...

void MenuListItem::select(bool select)
{
  borderImageView_->setVisible(select);
}

 


Andrey Fidrya, @zmeyc on twitter