02-23-2010 04:08 AM - edited 02-23-2010 04:11 AM
I'm using JDE 4.3
I have 4 ActiveRichTextFields inside a HorizontalFieldManager:
public VvfUpperField(Font fonts, int backgroundColors, byte attributes, long style, QuotesConstants qc)
super(NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL);
for(int n =1; n<=4; n++)
add(new ActiveRichTextField(" bbbbbbbbb ", qc.offsets3, attributes, fonts, qc.fg2, backgroundColors, (long)ActiveRichTextField.USE_TEXT_WIDTH));
the width of the ActiveRichTextField varies from the length of a text. But as a test, i placed " bbbbbbbb ". When i open the .cod file in any simulator (from 4.3-5.0) the project works perfectly. But when I try to debug it (whether in bb JDE or eclipse 3.4) the program throws an "illegalArgumentException". When I checked the width of the ActiveRichTextFields, the width is set to -1.
i already tried searching using the search tool above but i can't find an answer. i know it's called text wrapping, but is there a style constant for this, without having to do my own method?
Solved! Go to Solution.
02-23-2010 04:52 AM
With a RichTextField, the String that is passed in is formatted according to the Fonts and offsets passed in. This KB article explains this process:
How To - Format text in a RichTextField
Article Number: DB-00124
If you have a sequence of Fonts and Offsets, and then supply the Field with an arbitrary String, which is what you seem to be doing, then it might not like the combination. Ii this what is happening?
02-23-2010 08:17 PM
no, i've already set the offsets based on the test string. I was trying to adjust the width of the ActiveRIchTextField based on the supplied string.
I was using ActiveRichTextField since it accepts foreground color parameters. Thanks to the KB article, i looked at the RichTextField class and realized that i can overide the paint method of RichTextField. The KB article was really helpful, thanks!