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: 3
Registered: ‎01-07-2009
My Device: Not Specified

How to display a pointer and allow the user to click on an image?

I’m starting my Blackberry development using JDE and I would appreciate some pointers to get my first application going.


I want to display a image to the user and allow it to “point and click”, always assuming the user BB has a trackball.


I’ve manage to display the image using

 

add(new BitmapField(myImage,Field.FIELD_HCENTER));


Now I would like to display the “cursor” and allow the user to move it using the trackball.


I assume that the trackball movement would be capture with the method navigationMovement, right?


How can I display the current “cursor” position?

Thanks in advance

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: How to display a pointer and allow the user to click on an image?

Make sure you set the FOCUSABLE flag on this BitmapField. The system will paint a highlight cursor (based on the current theme) for you.

 

Place a FieldChangeListener on the field - this will notify you when the bitmap is clicked by the user.

 

If you take this "high-level" approach, your field will work on the most devices (trackball, touch, etc)) with the least amount of special coding.

 

New Developer
Posts: 3
Registered: ‎01-07-2009
My Device: Not Specified

Re: How to display a pointer and allow the user to click on an image?

Rex, Thanks for your input.

 

I've tried that:

 

add(new BitmapField(myImg,Field.FIELD_HCENTER|Field.FOCUSABLE));

But I dont see the img getting "highlighted".

Anyway that is not exactly what I want. I want to show a "pointer" of shorts so that the user can click on different areas of the image and I can tell from the app where did he/she clicked.

 

Any tips on how to do that?

 

Thanks!

Gonzalo

 

 

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

Re: How to display a pointer and allow the user to click on an image?

Please see this link.

 

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

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

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