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: 33
Registered: ‎07-16-2008
My Device: bold
Accepted Solution

Focus Field

my application have some bitmapfields. i displayed it to vertically using the verticalfield manager how to give the Focus for bitmapfiled while scorlling i tried with setfocus() . its not working
Developer
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: Focus Field

You can simply use the style: BitmapField.FOCUSABLE when you create the field.

This will make it focusable when you scroll.

However you have to remember one thing. The field may be already focusable, but you do not see it visually. In this case you need to draw a box around the image or use a different image for when the field has focus. This is done by overwriting the onFocus() and onUnfocus() methods.

 

 

 

BlackBerry Development Advisor
Posts: 15,140
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Focus Field

[ Edited ]

The following developer knowledge base article has an example of how to display focus changes.  Note that you will need to BitmapField.FOCUSABLE style.

 

How To - Show focus changes using BitmapField
Article Number: DB-00427

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

 

Or you can use an image with tranparent regions.  These will be highlighted when the field has focus.

Message Edited by MSohm on 07-29-2008 11:08 AM
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 33
Registered: ‎07-16-2008
My Device: bold

Re: Focus Field

[ Edited ]

hi all

Bitmapfields are already focused i get focus from onfocus() overriding method but i cant see visually so i try to draw a rectangle over the field using drawfocus.. but bitmap field wont focused 

protected void drawFocus(Graphics graphics, boolean on) { XYRect rect = new XYRect(); getFocusRect(rect); graphics.setColor(Color.RED); graphics.setDrawingStyle(Graphics.DRAWSTYLE_FOCUS, true); drawHighlightRegion(graphics, Field.HIGHLIGHT_FOCUS, on, rect.x, rect.y, rect.width, rect.height); }

 

 

how to draw a box over the field?

Message Edited by jeyaprakash on 07-30-2008 02:54 AM
BlackBerry Development Advisor
Posts: 15,140
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Focus Field

You can call drawRect from the graphics object you have to draw a rectangle around your bitmap.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker