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: 18
Registered: ‎01-27-2010
My Device: Curve 8330
My Carrier: Verizon
Accepted Solution

How to get RichTextField to wrap

[ Edited ]

Good Afternon fellow developers:

 

I was wondering if someone can help me with my issue. I trying to get the Text in my RichTextField to wrap when I place it in a verticalManager. Basically, if I have:

 

super(NO_VERTICAL_SCROLL);

 

 

lblUserText

 

= new RichTextField("Please select one of the following options below:");

 

 

 

VerticalFieldManager vfm =

new VerticalFieldManager()

 

vfm.add(lblUserText)

add(vfm);

 

The text in the RichTextField wraps to the next line just fine. But if I do the following:

 

 

 

 

 

 

super

(NO_VERTICAL_SCROLL);

 

lblUserText

= new RichTextField("Please select one of the following options below:");

 

 

VerticalFieldManager vfm =

new

VerticalFieldManager()

{

 

   protected void paint(Graphics graphics)

{

   graphics.setBackgroundColor(0xE8E691);

   graphics.clear();

   graphics.setColor(0x000000);

   graphics.drawText(lblUserText.getText(), 0,0);

 }

};

 

The text doesn't wrap. It goes off horizontally cutting off the "below:" text. Even if I say:

super(NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL);

it doesn't work. What am I doing wrong?

 

 

 

 

 

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to get RichTextField to wrap

Nothing.

 

If you want to take over painting the RichTextField yourself, then you have to implement the wrapping yourself.  drawText paints one line (and one line only).  So you have figure out where the lines break, paint the text on one line, move the "y" down and paint the next line with the next text (and so on). 

Developer
Posts: 18
Registered: ‎01-27-2010
My Device: Curve 8330
My Carrier: Verizon

Re: How to get RichTextField to wrap

Thanks for the response.

Developer
Posts: 62
Registered: ‎10-29-2008
My Device: 9800
My Carrier: Rogers

Re: How to get RichTextField to wrap

I wonder: If you paint the text for an ActiveRichTextField, does that lose any sort of auto recognition? i.e. will it still recognize URLS and phone numbers?

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to get RichTextField to wrap

I would expect that it will loose any hotlink capabilitiy, though it might get very confused about this.  I wouldn't recommend tryying it!