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: 86
Registered: ‎12-06-2012
My Device: Curve 8520
My Carrier: Blackberry store

How can get Container height and width

I want to get Container height and width.

how can i do it?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How can get Container height and width

Set you initial values to the values you specify in preferredWidth & preferredHeight, then you can attach a Layout Update Handler to the container to check if and when the dimensions change...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__layoutupdatehandler.html


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

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 86
Registered: ‎12-06-2012
My Device: Curve 8520
My Carrier: Blackberry store

Re: How can get Container height and width

I am creating a container and setting webView on it. i don't want to set preferred height or width of container.

is it possible to get container height or width as we can do with DisplayInfo::smileytongue:ixelSize().width().

 

 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How can get Container height and width

I haven't tested this but possibly not setting a width and height will fire the update handler anyway, although I wouldn't like to rely on this.

 

As far as I know my suggestion is the only reliable way of getting the dimensions, especially as you are relying on the OS to set them and not providing your own preferred ones.

 


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

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How can get Container height and width

You could set the update handler to the WebView and bind your container dimensions to the WebView this I think would pretty much guarantee the signal being generated.


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

Developer of stokLocker, Sympatico and Super Sentences.