07-07-2010 05:00 AM
hi,
New to blackberry development.I have seen that when I focus on any icon within my application, it gets surrounded by a blue rectangle filling the surrounding portions.
1) Can I change this color to some other ?
Or,
2) if a direct change of color is not possible ,Can I place that custom colored rectangle as an image under the icon and write appropriate methods on focus and unfocus?
Suggestions needed on required code to do the same.
TIA
Solved! Go to Solution.
07-07-2010 05:18 AM
welcome to the support forums.
the focus/highlighting is controlled by this method:
http://www.blackberry.com/developers/docs/5.0.0api
if you want to have a different image on focus you could overwrite drawFocus empty and change the bitmap of a bitmapfield onFocus/onUnFocus.
07-07-2010 08:58 AM
Hi Jack,
Welcome to the forums. Do take a look at the link provided by Simon. There are various ways to manipulate the focus, here's one that's not neccessarily the one you want but you get the idea.
protected void drawFocus(Graphics graphics,boolean on) {
XYRect rect = new XYRect();
getFocusRect(rect);
graphics.setColor( Color.RED);
graphics.drawRect(rect.x, rect.y, rect.width, rect.height);
graphics.setColor(Color.ORANGE);
graphics.setDrawingStyle(Graphics.DRAWSTYLE_FOCUS, true);
drawHighlightRegion(graphics, Field.HIGHLIGHT_SELECT, false, rect.x, rect.y, rect.width, rect.height);
}
Cheers.