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: 101
Registered: ‎01-06-2014
My Device: Q10
My Carrier: EE
Accepted Solution

Lack of support for shapes in Cascades

Why is it that there is no support for create shapes (such as rectangles) in Cascades? Also is there any kind of work around for this and is BlackBerry considering to support it anytime soon?

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

Re: Lack of support for shapes in Cascades

rectangles can be created by using a Container.
For other shapes you usually would use dedicated bitmaps/graphics.
----------------------------------------------------------
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: 101
Registered: ‎01-06-2014
My Device: Q10
My Carrier: EE

Re: Lack of support for shapes in Cascades

Really!? I never knew. Is there a page with BlackBerry that shows how to create one?

 

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

Re: Lack of support for shapes in Cascades

well, a container is a rectangle in form.
you can give it a background color to make it more recognizable, and use padding, margin and layouts to control its position.

As layering containers is no longer resource intensive you can create quite complicated structures using containers only.
----------------------------------------------------------
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: 101
Registered: ‎01-06-2014
My Device: Q10
My Carrier: EE

Re: Lack of support for shapes in Cascades

Is it possible to create a container with an outline colour and without a fill colour?

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

Re: Lack of support for shapes in Cascades

no.
but you can create two containers, give the inner a slightly reduced size and thus create a border.
you cannot have the whole thing be transparent though.
I guess you could use 4 containers for the border if you would really need a transparent one in between.
----------------------------------------------------------
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,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Lack of support for shapes in Cascades

In this case the easiest thing to do would be to create a 9-slice image and add it as the background image, you get your border and your transparancy then.

 

http://developer.blackberry.com/native/documentation/cascades/ui/image_resources/assets.html


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Lack of support for shapes in Cascades

If you need other advanced shapes like stars or stuff like that you can either use C++ QPainter

 

Or you could use a Webview and a graphics library like raphaelJS or KineticJS 

Developer
Posts: 101
Registered: ‎01-06-2014
My Device: Q10
My Carrier: EE

Re: Lack of support for shapes in Cascades

Is it possible to move the container to a different position?

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Lack of support for shapes in Cascades

the position of a container is based on the layout type your using

 

dock layout you can set its position horizontally or vertically

stack layout, the position is either top to bottom, or left to right, then you can use spacequota to space them out

 

or you can get really technical (not always reccomended) and use absolute layout and set an X,Y position for your container

 

https://developer.blackberry.com/native/documentation/cascades/ui/layouts/