10-13-2009 08:40 AM
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
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 ?
Solved! Go to Solution.
10-13-2009 11:25 AM
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'.
10-14-2009 06:06 AM
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
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.