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: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
Accepted Solution

How to get absolute pixel height of a control

I have a list view with two hard coded items in it.  I'd like to absoultely position the list view so that it's bottom edge is at a certain coordinate on the screen. (so that it's directly above another aboslutely positioned item on the screen)

 

To do this, I need to know the height of the list view.  I can estimate that by multiplying the number of items in the listview by 111, but that is obviously very brittle.

 

What's the right way to do this?

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

Re: How to get absolute pixel height of a control

This has been asked a number of times and of course it's best not to hard code the values as they vary across devices and may change in the future.

 

... you can use a layoutupdatehandler to dynamically find it...

 

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

 

http://supportforums.blackberry.com/t5/Native-Development/How-to-get-a-size-of-bb-cascades-Control-o...

 

 


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: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: How to get absolute pixel height of a control

Ah, right.  I actually knew that but then forgot I knew it!  My app actually uses this technique in one spot to get the size of the screen. Oddly when I searched the forums I couldn't find any meaningful results.