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: 152
Registered: ‎04-28-2012
My Device: BlackBerry 9800
My Carrier: BlackBerry

How to get the width of the label?

Hi,

 

I am designing one simple page in bb10 using c++,there i want to set the width of the label to the exact width of that particular lable i.e., i want to set the width of that label dynamically.

Developer
Posts: 849
Registered: ‎03-03-2011
My Device: Z10

Re: How to get the width of the label?

First you must find Label from C++ code (use name defined under objectName):

 

Label *plabel = root->findChild<Label*>("myLabelObjectName");

 
Then set min/max width:
 
plabel->minWidth(100);
plabel->maxWidth(100);
 
--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to get the width of the label?

[ Edited ]

Your thread topic and your description don't match.

 

For the question you asked, you set preferred width and height, or for the exact width, the min and max width, in QML or C++.  All of the samples do some form of this.

 

For the thread topic, check out the recent:

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

 

 

Stuart