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

Reply
Developer
myraddin
Posts: 409
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 :smileysad:

 

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"
Please use plain text.
Developer
peter_strange
Posts: 19,601
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'.

Please use plain text.
Developer
myraddin
Posts: 409
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 :smileyhappy:

 

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"
Please use plain text.