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

Adobe AIR Development

Reply
Developer
apman
Posts: 194
Registered: ‎11-12-2010
My Device: Not Specified
Accepted Solution

Optional linebreaks in Labels?

I have a few Labels that fit on one line in landscape view, but take up two lines in portrait. Is there a way I can put something like *suggested* break points into the text that will only be used if the text doesn't fit into one line? Or maybe a kind of non-breaking spaces, just to prevent line-breaks in really awkward places?

 

 


My app : Get set - Get up!   Get ready for the snooze revolution.

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Optional linebreaks in Labels?

Don't believe so. Might want to just force the break where you want it (\n).
Developer
apman
Posts: 194
Registered: ‎11-12-2010
My Device: Not Specified

Re: Optional linebreaks in Labels?

yes, but then they get applied in the landscape scenario too, unless I add some code to change each layer's .text on orientation change, which seems kind of overkill ...

 

But thanks anyway - at least I know now that I'm not missing some well-known LaTeX style command for smart dynamic layouts, that everybody else knows about! :-)

 

 


My app : Get set - Get up!   Get ready for the snooze revolution.

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Optional linebreaks in Labels?

You could add some code to split the words into an array, incrementally add words until it is too long to fit on the button, else add a LF. Recall it on an orientation change.
Developer
analytik
Posts: 38
Registered: ‎08-02-2012
My Device: Q10

Re: Optional linebreaks in Labels?

Am I missing something, or \n line breaks don't do anything for BB10 Fuse Labels? I know I can use TextArea, but that's incredibly ugly compared to simple Labels.

There are properties width, minLines and maxLines, but they just don't make a difference.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Optional linebreaks in Labels?

maxLines will give you multiple rows. Set it to 0 for any number. Be certain to size the label so the height can take into account the multiple rows.
Developer
analytik
Posts: 38
Registered: ‎08-02-2012
My Device: Q10

Re: Optional linebreaks in Labels?

Hooray, thanks! Setting maxLines helped. I guess my assumption was that Fuse automatically does
if (maxLines != 0 && maxLines < minLines) { maxLines = minLines }
Developer
apman
Posts: 194
Registered: ‎11-12-2010
My Device: Not Specified

Re: Optional linebreaks in Labels?

Hehe, that's weird - how did you manage to accept an answer as solution when it's my original post ...? (it doesn't solve the problem stated in the headline)

 

Anyway, glad you got what you needed and since my idea of having a way to mark 'preferred' breaking points doesn't seem to have a solution, it doesn't really matter. I'm just confused, cause I only ever see the "Accept as Solution" button on my own posts ....

 


My app : Get set - Get up!   Get ready for the snooze revolution.

Developer
analytik
Posts: 38
Registered: ‎08-02-2012
My Device: Q10

Re: Optional linebreaks in Labels?

Yeah, that's weird, I didn't accept his post as solution, I just Liked his post and then did Quick Reply... probably a forum bug :smileyhappy:

Regarding your solution, I think what jtegen suggested is reasonable, while annoying to program, it should do the job - append the words one by one, check their length and break according to your logic. Or really, just have two versions of the text and manually optimize for both orientations.
Developer
apman
Posts: 194
Registered: ‎11-12-2010
My Device: Not Specified

Re: Optional linebreaks in Labels?

Ah, even weirder ... :smileyhappy:

 

I have quite a lot of labels with quite a bit of text (up to 3 lines) and each of them in 3 languages - so I've just decided to lower my typograhic standards a bit for now. But yes, at least that's a good way of solving the issue in principle or in a few cases where it really matters.

 

Cheers

 


My app : Get set - Get up!   Get ready for the snooze revolution.