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
Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

navigationMovement weirdness

navigationMovement weirdness

I have a Screen with a HorizontalFieldManager containing three Bitmapfields (icons) and
a VerticalFieldManagers below containing various fields.

The icons all take focus. I can use navigate horizontally between the icons with the
four-way nav and arrow keys (up and left go left; down and right go right).

If I override navigationMovement on the Screen and just return false, I can no longer
go left or right with four-way or arrow keys to move between the icons.

I want to do some processing inside navigationMovement, but even
this simple code disables half the navigation.

What am I doing wrong? Using 8900 simulator.

Thanks
Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: navigationMovement weirdness

Please specify your question more clearily. what you wnat to do exactly?

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

Deepesh Gupta
Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

Re: navigationMovement weirdness

When I override navigationMovement in the simplest form I lose the ability to navigate between fields

using the four-way nav (left and right) or the lef/right arrow keys. Otherwise it works fine.

 

How do I override navigationMovement and retain complete left/right navigation?

Developer
Posts: 176
Registered: ‎11-06-2008
My Device: Not Specified

Re: navigationMovement weirdness

[ Edited ]
you're going to need to post some of the code you have for navigationMovement currently so we can see what's going wrong
Message Edited by jhw1701 on 09-10-2009 03:26 AM
Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

Re: navigationMovement weirdness

protected boolean navigationMovement(int dx,int dy, int status, int time) { return false; }

 

I had other code in here but the behavior can be duplicated by just returning false.

 

 

Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: navigationMovement weirdness

Please specify your exact scenario

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

Deepesh Gupta
Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: navigationMovement weirdness

Have you tried returning super.navigationMovement(dx,dy,status,time) rather than returning false

 

Regards

Bikas

Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

Re: navigationMovement weirdness

[ Edited ]
Message Edited by tkroll on 09-10-2009 04:50 AM
Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

Re: navigationMovement weirdness

Here's some code. I've stripped it down.

 

 

final class MyScreen extends MainScreen { private Toolbar tb; public MyScreen() {

 

  this.tb = new Toolbar();

add(this.tb); } protected boolean navigationMovement(int dx,int dy, int status, int time) { return false; } }

 

  

class Toolbar extends Manager { private BitmapField button1; private BitmapField button2; private BitmapField button3; public Toolbar() { super(NO_HORIZONTAL_SCROLL | NO_VERTICAL_SCROLL | USE_ALL_WIDTH); this.button1 = new BitmapField(Bitmap.getBitmapResource("img/button1.gif"), FOCUSABLE) { public void onFocus(int direction) { super.onFocus(direction); setBitmap(Bitmap.getBitmapResource("img/button1_over.gif")); } public void onUnfocus() { super.onUnfocus(); setBitmap(Bitmap.getBitmapResource("img/button1.gif")); } protected boolean navigationClick(int status, int time) { // some stuff return true; } protected void drawFocus(Graphics _g, boolean _on) { /* do nothing */ } }; this.button2 = new BitmapField(Bitmap.getBitmapResource("img/button2.gif"), FOCUSABLE) { public void onFocus(int direction) { super.onFocus(direction); setBitmap(Bitmap.getBitmapResource("img/button2_over.gif")); } public void onUnfocus() { super.onUnfocus(); setBitmap(Bitmap.getBitmapResource("img/button2.gif")); } protected boolean navigationClick(int status, int time) { // some stuff return true; } protected void drawFocus(Graphics _g, boolean _on) { /* do nothing */ } }; this.button3 = new BitmapField(Bitmap.getBitmapResource("img/button3.gif"), FOCUSABLE) { public void onFocus(int direction) { super.onFocus(direction); setBitmap(Bitmap.getBitmapResource("img/button3_over.gif")); } public void onUnfocus() { super.onUnfocus(); setBitmap(Bitmap.getBitmapResource("img/button3.gif")); } protected boolean navigationClick(int status, int time) { // some stuff return true; } protected void drawFocus(Graphics _g, boolean _on) { /* do nothing */ } }; add(this.button1); add(this.button2); add(this.button3); } protected void sublayout(int width, int height) { if (getFieldCount() > 0) { BitmapField _button1 = (BitmapField)getField(0); int w = _button1.getBitmapWidth(); int h = _button1.getBitmapHeight(); layoutChild(_button1, w, h); setPositionChild(_button1, 5, 5); Field _button2 = getField(1); layoutChild(_button2, w, h); setPositionChild(_button2, _button1.getLeft() + w + 5, 5); Field _button3 = getField(2); layoutChild(_button3, w, h); setPositionChild(_button3, _button2.getLeft() + w + 5, 5); setExtent(width, h + 10); } } }

 


When I remove the overridden navigationMovement I can navigate between the BitmapFields using the four-way nav left & right or with left/right arrow keys. If I leave it in, I cannot.

 

Thanks!

 

 

 

Contributor
Posts: 13
Registered: ‎03-04-2010
My Device: 9700
My Carrier: XL Axiata

Re: navigationMovement weirdness

please post for the solution...

i had a same problem here...

Smiley Sad