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

Posts: 147
Registered: ‎09-10-2008
My Device: Not Specified

Focus problem in Button Field


I have two vertical field manager and three horizontal field manager Each have two buttonfield totally six button fields on the screen when I scroll the focus should move from top to bottom but   focus is going from left to right.

should move
B1->B2 ->B3->B4->B5->B6


but now B1->B3->B5->B2->B4->B6


How to control the focus on the button field




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

Re: Focus problem in Button Field

Picture is not visible.


Default behavior for all managers is focus on the last field in the their list when focus comes back to them, and the first on the list when focus moves forward to them.  So by carefully using the managers you have, you might be able to manage the focus movement you want.  Alternatively you will have to override the focus behavior for the manager to set the focus where you want to be. 


There are other posts that talk about this, specifically for HorizontalFieldmanagers.  Have a search of the forum and you will probably find someone else has tried to do something similar.  You will need to look at onFocus and moveFocus.


Alternatively, you might find the that TableLayoutManager will layout your Fields without requiring multiple Managers and focus will move as you want.  You can find code for this manager, in the following KB Article.


How To - Create a rich UI layout with TableLayoutManager
Article Number: DB-00783