Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
10-30-2012 04:36 PM
It is sometimes required to retrieve the size of a control (a button, a label ... etc).
I have struggled find a property or method that would allow me to read the current control size.
Is it possible at all?
Solved! Go to Solution.
10-30-2012 04:43 PM
10-30-2012 04:48 PM
Thanks, but this is a handler for changes in the layout (position, size ...). If the size and position do not change - how does one get that information?
10-30-2012 05:29 PM
10-30-2012 07:51 PM
That is understood, but the problem arises with a situation like this
bb::cascades::ImageView* anImageView = new bb::cascades::ImageView();
Loading an image like this will set the ImageView size to the size of the image by default. At this point I would like to know the size of "anImage" control. I understand that I could have connected the layout events to the object before I assigned the image source, but then I have to manage and keep that information somewhere. What if I have 10, 20, 100 of these little images. I would have to create a wrapper object or a new one inheriting from the ImageView just so I can connect the events and store the information somewhere so I can use it on demand.
That information must be available somewhere. I can't believe that there is no access to it. If there isn't - it's really a missing piece.
QImage has information about the image size. Casscade's Image (accessible through the ImageView as well) doesn't.
10-30-2012 08:24 PM
10-31-2012 09:37 AM
Yes - I am aware of the ImageData - thanks. The problem is when one wants to use the AbsolluteLayout and layout other controls based on the sizes and positions of other controls.
I used the ImageView control because that was the easiest to demonstrate the issue with.
translationX() property is also being changed by the layout of the controls, yet it is accessible on demand. I do not understand why there is no property called "currentSize" for example.
We'll find some workaround, but this is definitely a shortcoming - particularly when one uses the AbsoluteLayout.
10-31-2012 10:50 AM
Since we need for a particular subset of custom made controls, we decided to use the LayoutUpdateHandler after all.
If anyone has needs for similar functionality - here how we did it.
Our control(s) have a private QRectF currentBounds; member.
In the control's constructor we added the following
Then implemented a private slot onLayoutFrameChanged(QRectF& bounds) and update the private currentBounds member.
It's not pretty and, most importantly, should not be really needed in our opinion, but it works and we can always access the "currentBounds" property to get the actual bounds.