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
Trusted Contributor
marcelnijman
Posts: 118
Registered: ‎06-19-2012
My Device: PlayBook + Red Z10 + BB10 Dev Alpha C

get size of View

How to find out the current size of a View?

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

Re: get size of View

The first question is: are you sure you need this?  What are you trying to achieve?

 

This is not currently available.


Let's suppose you could get the width and height.  Bear in mind that the UI thread is running in the background, so if you could get the size, it would reflect the last known value.  You should be able to design most apps without knowing the final layout sizing of elements.  If you feel you must have these values, let's discuss.

 

Stuart

Trusted Contributor
marcelnijman
Posts: 118
Registered: ‎06-19-2012
My Device: PlayBook + Red Z10 + BB10 Dev Alpha C

Re: get size of View

I have created a number of controls which combine overlapping views. In object-oriented style, I would like to create the view hierarchy during construction, and layout the view just before it becomes visible, at which point I need to know the size of the parent view. Also, if my control is assigned a new size, I would like to receive a signal, so that I can layout the view again.

 

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

Re: get size of View

In R4 you can get the size of a ForeignWindow.

Connect to signal controlFrameChanged

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

 

Stuart