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

New Contributor
Posts: 2
Registered: ‎07-27-2011
My Device: 9630
My Carrier: Tata Indicom

Trackball abnormal behaviour



I m developing  application in which One of my screen hv 7 items with icons and their respective labels

They are arrenged by using  a class extending Manager.4 items in first  row and rest of all in second row.


When i move traceball in right side or  ddownward it selectes the item correctly....but My problem starts when i wann to select left side menu items(frm current position)..it didnt move to it or show abnormal behaviour(some time selects ,some time selects by skipping  .any thing...) it makes me nut


This is the snippet of my class code to add items


public class static  GridManager extends Mananger


int cols;

public GridManager(int cols)


Super(Manager.USE_ALL_WIDTH|Manager.Vertical _Scroll)



protected  void sublayout()


//Where i m setting the position and layout of my manu items




 can Blackberry ppl,help me to sort out my prob



Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Trackball abnormal behaviour

Hello N_Verma,


The GridFieldManger itself is treated as one (1) field in your main manager. Therefore, consider if you have a VerticalFieldManager containing three Fields:

1) A LabelField.

2) A GridFieldManager.

3) A LabelField.


Therefore, if your focus is on (1) and you scroll down, the focus will shift to (2); by default, the GridFieldManager will give focus to the first item. So, if the GridFieldManager contains three EditFields, the top-most EditField will receive focus.


Now that the GridFieldManager has focus, additional scrolling will be defined by the GridFieldManager and scrolling down/up within the GridFieldManager should jump between the EditFields as expected.


Once you reach the bottommost EditField (within the GridFieldManager) scrolling down should jump to (3) and navigation is now decided again by the outtermost VerticalFieldManager.


All of this is to say that, if you are now at (3) and you scroll up; it is the GridFieldManager that receives focus (not the GridFieldManager's children.) Therefore by default the GridFieldManager gives its first child focus.


So, scrolling up from (3) will jump over all of the GridFieldManager's children and place focus with the first child. In order to produce a more fluid focus change you will need to override the firstFocus(int) method based on the incoming direction:



Prior to 6.0 similar results can be obtained by overriding onFocus(int):



If you want to modify the navigation when inside the GridFieldManager, you will need to take a look at nextFocus(int, int):



Generally, nextFocus() should not be required though unless you are looking for a customized navigation path.


I realize there is a lot of information upt here. If you have any further questions, by all means feel free to ask. After reading through the above and checking your source, if you still see issues, let us know.


Erik Oros

BlackBerry Development Advisor

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.