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
JoVinz
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: TableLayoutManager focusing problem

If i remove Horizontal scroll from vfm, then i am unable to scroll horizontally through all the fields i am adding in TableLayoutManager.
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: TableLayoutManager focusing problem

[ Edited ]

I can confirm that I see the behaviour that you see. 

 

I am not as good at these sorts of things as arkadyz, so would accept his advice that nextFocus would be the better place to do this. 

 

Anyway, the following method when added to TablelayoutManager fixes this behaviour.  You might in fact be able to replace navigationMovement with code in nextFocus, I have not tried to do this.

 

Hope this helps:

 

    protected int nextFocus(int direction, int axis) {
     if ( axis == Field.AXIS_VERTICAL ) {
      int focusIndex = getFieldWithFocusIndex();
      focusIndex += _columns * direction;
            if (focusIndex < 0 || focusIndex >= getFieldCount()) {
                return -1;
            } else {
                return focusIndex;
            }
     } else {
      return super.nextFocus(direction, axis);
     }
    }

Please use plain text.
Developer
JoVinz
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: TableLayoutManager focusing problem

@ Peter & arkadyz
U solved my problem. nextFocus() is the solution. Thanks a lot.
Please use plain text.