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
New Developer
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Cursor gone in black ActiveRichTextField

In my app  I use an ActiveRichTextField and recently I decided to visually improve it.  I went with a dark theme and it looks great except for the fact that the cursor disappears now that I changed the color of the field.  It is a pain because there is information that the user needs to highlight and copy.  I've searched the forums and the web all night and haven't been able to find a solution, the closest I got is a post that said it has to do with using graphics.clear().  Any help or pointers would be greatly appreciated.

 

 

ActiveRichTextField TextField = new ActiveRichTextField("Text") { public void paint(Graphics g) { g.setBackgroundColor(Color.BLACK); g.setColor(Color.SILVER); g.clear(); super.paint(g); } };

 

 

 

New Developer
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Re: Cursor gone in black ActiveRichTextField

I forgot to add something, I've been wanting to force a font and font size in my app and haven't quite grasped it yet.  The most I've been able to do is make it bold, italic, etc.  If you could use an example with the textfield I posted above it would be greatly appreciated.

 

Thank you.

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Cursor gone in black ActiveRichTextField

It is known issue that when you set background color in the ActiveRichTextField the cursor disappear.

There must be something how we can set background color and cursor appear Or maybe its a bug of RIM.

 

But you can change the color of the Text.

And for setting font and font size you can try something like:

 

ActiveRichTextField TextField = new ActiveRichTextField("Text") { public void paint(Graphics g) { //g.setBackgroundColor(Color.BLACK); g.setColor(Color.SILVER); g.clear(); super.paint(g); } }; int fontSize = 15; //available fonts FontFamily fontfam[]=FontFamily.getFontFamilies(); Font font= fontfam[1].getFont(FontFamily.SCALABLE_FONT, fontSize).derive(Font.BOLD); TextField.setFont(font); this.add(TextField);

 

Regards

Bikas

 

 

New Developer
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Re: Cursor gone in black ActiveRichTextField

Awesome, thanks for the advise.  The font worked like a charm, just had to debug and look at the array so I could see what all of the font choices where. 

 

Its a shame about the TextField background color, I would be great it RIM would fix it.  Is there a way to redraw or create your own cursor or would it be to much of a pain just to have a purdy background?

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Cursor gone in black ActiveRichTextField

There is no direct mothod to customize the cursor.

But I think you can draw the cursor by yourself though never tried this by myself before. Smiley Happy

 

Have a look at this thread. You might get some idea.

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=10562&query.id=22...

 

Regards

Bikas

New Developer
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Re: Cursor gone in black ActiveRichTextField

I had a look at that thread and think they are still battling it out as well.  I thought of a possible workaround to my problem.  If the user can not select text I can live with that but there are links to phone numbers that they can call.  Can you make that phone link without an ActiveRichTextField.  If so I'll just draw everything as labels or something similar and color everything individually.
Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Cursor gone in black ActiveRichTextField

Have a look at this HrefField example. This might help you.

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=65#M65


Regards

Bikas

New Developer
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Re: Cursor gone in black ActiveRichTextField

Thank you for the link but I do not see how you can set the link to what you want it to do.  After thinking about it some, I think I'm going to try another appoach using multiple ActiveRichTextFields.  In a nutshell my app is just a store directory for my company that contains all of the contact numbers for thosed involed with the store and an address.  I think i'm going to use a field for each item and just have the field change color on scroll over so that the user know that it is clickable.

 

Example

 

StoreNameField

AddressField

NameField ... NumberField

NameField ... NumberField 

NameField ... NumberField 

etc.

 

I'm not sure exactly how it is going to work yet but I will post back if I can come up with something useful to share.

 

Thanks for all of the help so far guys.

 

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Cursor gone in black ActiveRichTextField

ooh I thought you wanted to create a link.

Just ignore my previous post.

 

Regards

Bikas

 

Highlighted
New Developer
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Re: Cursor gone in black ActiveRichTextField

In a sense yes, I want it to where when you click on the number you have the option to call just like in the ActiveRichTextField and I want to link the address so when you click it, it will copy it to the clipboard.

 

I didn't see in the link you gave my how it could acheive that unless I was missing something.