04-03-2009 08:21 AM
Hi All,
Is it possible to change the default selection color (Blueish) to some other color?
Thanks,
Sandeep
Solved! Go to Solution.
04-03-2009 12:54 PM - edited 04-03-2009 01:04 PM
Hi,
You can not change the selection color.
This selection is same on emulators i.e blue but on device it can differs from pink to blue to yellow plus I guess it depends upon the theme
set on phone.
You can do one thing you can override the paint of that particular component and change the focus color.
May be this will help you.
04-06-2009 08:06 AM
Hi Sandeep,
Yes you can change the default selection color in listField and that to without overriding paint method.
As I found out in other thread related to ListField.
Here is the link of that thread
just include <listField instance>.invalidate(<index>);
as the last line of your drawListRow().
This will help you in changing the color of selection in listField.
04-06-2009 12:49 PM - edited 04-06-2009 12:51 PM
Allow me to take this a step further. You can mimic the way it is done natively at the java layer. It will be a bit slower, but it is not noticable. Check it out:
protected void drawFocus( Graphics g, boolean on )
{
XYRect focusRect = new XYRect();
getFocusRect( focusRect );
int yOffset = 0;
if ( isSelecting() )
{
yOffset = focusRect.height >> 1;
focusRect.height = yOffset;
focusRect.y += yOffset;
}
g.pushRegion( focusRect.x, focusRect.y, focusRect.width, focusRect.height, -focusRect.x, -focusRect.y );
g.setBackgroundColor( YOUR_DESIRED_COLOR );
g.setColor( 0xFFFFFF );
g.clear();
this.paint( g );
g.popContext();
}
*Note: Sometimes this editor butchers my code inserts. Will edit if it looks bad.
Yep it messed up the code insert. Does anyone know why? Maybe it doesn't like the newlines from the JDE?
08-27-2010 12:31 AM
Excellent fix for the highlighting color! Used this for the BitmapField and it worked flawlessly.
Thanks!
08-24-2011 11:29 PM
Excellent solution. I just don't understand why the scroll values are negative...
Do you know why?
Thanks!