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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Developer
Posts: 33
Registered: ‎11-23-2009
My Device: Not Specified

Navigation Movement Pointer

Hi All,

 

Is there anyway i can display a mouse pointer for navigation movement in BlackBerry.

 

If yes how can i control the smoothness of movement of the pointer?

 

 

Regards

Subrat

Developer
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: Navigation Movement Pointer

You can draw a mouse pointer by overriding the paint method.

The smoothness will depend on you and how many pixels you move the pointer per movement.

New Developer
Posts: 33
Registered: ‎11-23-2009
My Device: Not Specified

Re: Navigation Movement Pointer

Thanks for the suggestion .

 

After overiding paint method I was able to have a pointer as bitmap drawn and passed X and Y positions which made the pointer move on trackball movement.

 

Here is the code:

 

Bitmap pointer = Bitmap.getBitmapResource("Mouse_pointer_small.png");

 

protected boolean navigationMovement(int dx, int dy, int status, int time)
    {
        
        if (dy > 0)
        {
            y += 15;
        }
        if (dy < 0)
        {
            y -= 15;
        }

        if (dx > 0)
        {
            x += 15;
        }
        if (dx < 0)
        {
            x -= 15;
        }
        invalidate();
        return super.navigationMovement(dx, dy, status, time);
    }

    protected void paint(Graphics graphics)
    {
        graphics.drawBitmap(x, y, pointer.getWidth(), pointer.getHeight(), pointer, 0, 0);

    }

 

As you see I am moving 15 pixels per movement but it is not so smooth and even i wan't to control the acceleration of the mouse mointer .

Developer
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: Navigation Movement Pointer

try moving less pixels and see if that helps with smoothness.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Navigation Movement Pointer

I would recommend that you use the dx and dy as a factor in your movement to.  I think you will find that they actually vary depending on how quickly the user has moved their finger. 

New Developer
Posts: 33
Registered: ‎11-23-2009
My Device: Not Specified

Re: Navigation Movement Pointer

I reduced it to 5 pixels and it certainly removed the jerks from the movement but If user is playing a Game and has to click some elements within some time period then how the user will be able to move the pointer quickly to that co-ordinate.

Developer
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: Navigation Movement Pointer

You can create a background thread to process the movement. Every movement let the thread process 15 pixels but 5 pixels at a time and sleep for some time before processing the next  5 pixels.

This will require the screen to redraw 3 times every movement though. But it's something you can try.