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
Highlighted
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How to find absolute position of the last character in the label

As luck would have it this has just been discussed in the Java forum and so saves me some typing. Smiley Very Happy

 

http://supportforums.blackberry.com/t5/Java-Development/Relation-between-Pixels-and-Points-in-blackb...


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.
New Contributor
Posts: 8
Registered: ‎01-30-2014
My Device: Z10
My Carrier: BalalaykaTelecom

Re: How to find absolute position of the last character in the label

That's cool, thanks. But I've already solved this problem)
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How to find absolute position of the last character in the label

Excellent, if you're allowed it might be good to post your solution so others can benefit from your experience.


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.
New Contributor
Posts: 8
Registered: ‎01-30-2014
My Device: Z10
My Carrier: BalalaykaTelecom

Re: How to find absolute position of the last character in the label

Not sure that it's a good idea to spread solutions like this one.

But anyway - here it is.

 

1. We need to know the height of a label containing a single line. In my case I've just test it once and then was using this value ( for my fixed font size - 53px ).

2. Create a label, containing desired text and check its height is over 53px.

3. If not - just move our button ( or any other control ) after the label in horizontal StackLayout.

4. If so - begin to remove a single word from the end of desired text until the label get shorter. After that put removed text on a different label and arrange it with button as in previous step.

 

The entire solution was a little bit more complicated, but the main idea is the same.

 

Good luck! Smiley Happy