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

Java Development


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.


Reply
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810
Accepted Solution

FlowFieldManager not 'compatible' with text fields ?

Hi all.

 

I am trying to make an icon to follow the end of a given text. Much like the phoneLog does it with the green phone icon following any number you input.

 

I tried Overriding the DrawText, but unfortunately after wrapping to new line I don't have an X coordinate where to start drawing.

 

this is what I would like:

 

+-----------++-----+

| text 1234 || icon |

+-----------++-----+

 

after inputting some more text:

 

+--------------------++-----+

| text 1234567890 || icon |

+--------------------++-----+

 

Unfortunately FlowFieldManager wraps the icon to the new line Smiley Sad

 

It seems it does that before and after every text field. If I have two icons one after the other, they have a horisontal layout, but the moment I add a textField, it is wrapped  to a new line (added after the icons) or the icons are pushed to the next line (if the textbox preceded the icons).

 

So how can I add this icon to follow the text length ?



"Listen carefully, I shall say this only once"
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: FlowFieldManager not 'compatible' with text fields ?

The issue here is that text Fields normally tell their enclosing manager that they want to take up the whole Width.  FlowFieldManager will respect that, and give them the complete width.

 

You will have to customize the Text Field, override layout and width functions, and make sure it only asks for the size it actually needs.

 

If the text can not be updated, then you try using LabelField rather than RichTextField.  LabelField only asks for the width it needs.

 

Sorry I can't give you any suitable code because I have never done this.  I haven't done it because from a UI perspective I don't think this looks good.

 

This mechanism may will fail when the Text Field takes up more than the size on one Width - Fields are always 'rectangular'.

Highlighted
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: FlowFieldManager not 'compatible' with text fields ?

Thanks for confirming what I had suspected (about the textFields always 'consumes' full width of the manager).

 

Yeah, I already tried the custom text field.... and it did not work fine, and the reason is your last statement Smiley Happy

 

So, I guess RIM did it by overriding the drawText (or paint) methods because their icon correctly follows the end of text.

 

That means there has to be a way to properly calculate the exact position of the end of text... then just draw the icon there and that's it.

 

Well... sounds easier than it actually is.

 

 

Anyway, thank you for the valuable input, I appreciate it.



"Listen carefully, I shall say this only once"