The Limit of a Multi-line Label as it Approaches Awesome [CFA]


Every once in a while you hear of some wicked Cascades tricks and tips and wonder if they’re legit. There is rampant speculation that there may actually be a team within BlackBerry behind such awesomeness. Let the truth be out there. There is a team! The Cascades Field Agency team (CFA) is behind all this. These fearless types identify potential problem areas within Cascades and dare to try them out before they reach the internal app teams. They even travel the world for onsite assistance, participate in API reviews and work on making the Cascades development experience even more awesome. You’d think that’d be enough for one team, but no, they even blog about their experiences, tricks and tips on internal BlackBerry blogs.

Such information can’t stay hidden and must reach external developers. That is why we’ll be sharing their Cascades tips and tricks in a new CFA series. This is the first blog of such series, with many more to come. Enjoy! – @suavekz

The Inside BlackBerry Developer Blog is a great place to find announcements and learn what goes on behind the scenes here at BlackBerry. But the best posts are the ones that have code!  Samar and myself will be publishing a series of blog posts that highlight some of the cool things you can do with the Cascades framework. These are features that have been added to BlackBerry 10.1 that you may have missed and tricks that we have learned along the way.

We’ll start with a quick look at the update to the Label control in Cascades 10.1. Developers now have the ability to limit multi-line labels to a specific number of lines. Simply add autoSize to your label and set the maxLineCount property. This property only has effect if the multiline property is set to true.

Label {
// The multiline property needs to be set to true in order to wrap the text
// on multiple lines.
multiline: true
autoSize {
maxLineCount: 3

See the documentation on Cascades Labels for more information.


Join the conversation

Show comments Hide comments
+ -