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

Posts: 178
Registered: ‎11-19-2008
My Device: Not Specified
Accepted Solution

Transparent background for ObjectChoiceField

[ Edited ]

I have to put an ObjectChoiceField on a screen which haves a background image. The image is painted in the overridden paint() method of a VerticalFieldManager. By default, the field paints itself with a white background, but I want to display only the text and see the image below. The tag is painted with transparent bg, but the selection area has a blue bg when focused and a white one when unfocused (this is what I want to change to transparent).
Is there a way of doing this without performing full low level painting?
I tried this:


ObjectChoiceField ocf = new ObjectChoiceField(tag, options, options.length - 1, Field.FIELD_BOTTOM | Field.FIELD_LEFT) {
public void paint(Graphics g) {
g.setBackgroundColor(0xFFFFFFFF); //the alpha byte is set to full transparent

but has no effect.

Also I would like to paint the tag in a different color than the selector area, and if possible, change the option list's grey background to a semitransparent one.


Message Edited by darkberry on 11-28-2008 03:22 AM
BlackBerry Development Advisor
Posts: 15,813
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Transparent background for ObjectChoiceField

The ObjectChoiceField does not expose methods to control the background colour of the option field.  The area behind the label should appear transparent, but the option portion of the field should use the colours for the current theme.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.