BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-31-2007, 04:14 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2006
Location: Tacoma, WA
Model: 9630
OS: 4.7.1.40
PIN: 30bed4bd
Carrier: Verizon
Posts: 32
Post Thanks: 0
Thanked 1 Time in 1 Post
Default How to set Highlight/Focus Color in MainScreen

Please Login to Remove!

In my application, I have a MainScreen object which contains several focusable/selectable fields. As I roll over them, they get highlighted with a changed background color (relative to the fields without focus). This color seems to be inhereted from the overall theme (other applications have this same highlight color).

In the context of the MainScreen object for my application or the individual fields, how can I get() and set() the highlight color? or instead, do I need to override drawHighlightRegion() with a Graphics object (and associated color) of my own construction or ...?

Thanks for any help.

- Scott
Offline  
Old 08-08-2007, 10:08 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 8300
PIN: N/A
Carrier: AT&T
Posts: 25
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Scott

Did you find a way to do what you were looking for?
I was looking to do the same thing for rows in the list field. Setting the background color can be done by using the fillRect() in the paint method, but I did not find a way to change the highlight color. I think it is related to the theme ???

Thanks
rab
Offline  
Old 08-08-2007, 10:50 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Create a custom field, extend Field. Override the drawFocus method like so:
protected void drawFocus(Graphics g, boolean on) {
g.setBackgroundColor(someColor);
g.clear();
super.drawFocus();
}
Offline  
Old 08-14-2007, 04:05 PM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2006
Location: Tacoma, WA
Model: 9630
OS: 4.7.1.40
PIN: 30bed4bd
Carrier: Verizon
Posts: 32
Post Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by bemshaswing View Post
Create a custom field, extend Field. Override the drawFocus method like so:
protected void drawFocus(Graphics g, boolean on) {
g.setBackgroundColor(someColor);
g.clear();
super.drawFocus();
}
Thanks bemshaswing, but that didn't work. It left the trailing Field background in "someColor", but the highlight of the field with focus was still that inherited from the theme.
(in my case a deep blue from Dimension-Zen). Other suggestions? - Scott
Offline  
Old 08-15-2007, 06:35 AM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Location: Bangladesh
Model: 8800
PIN: N/A
Carrier: EDGE
Posts: 93
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Scott8586,

Create a custom Button Field:
Code:
class CustomButtonField extends ButtonField {    
    // Constructs a new ButtonField instance with provided label.
    CustomButtonField(String label) {
        super(label);        
    }    
    // Draws the focus indicator for this field.
    protected void drawFocus(Graphics g, boolean on) {
        g.setBackgroundColor(Color.RED);
        g.clear();
        //super.drawFocus();
    }
}
Add this code where you do like to place your custom Button Field:
Code:
CustomButtonField submitBtn = new CustomButtonField("Submit");
add(submitBtn);
Hope for the best!

Cheers,
ARIF

Last edited by arifzaman : 08-15-2007 at 06:40 AM.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.