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
New Developer
frederidp
Posts: 5
Registered: ‎09-26-2010
My Device: Bold 9700

Re: Scroll happening but Vertical Field Manager Not Moving

Another solution can be reimplement the onFocus method on the field you're adding to the manager:

 

protected void onFocus(int direction) {
Manager manager;
int managerHeight = -1;
int managerScroll = -1;
int currentTop = -1;

manager = this.getManager();
if(manager != null) {
managerHeight = manager.getPreferredHeight();
managerScroll = manager.getVerticalScroll();
currentTop = this.getTop();

if(direction == 1 && currentTop > (managerScroll + managerHeight)) {
manager.setVerticalScroll(currentTop);
} else if(direction == -1 && currentTop < managerScroll) {
manager.setVerticalScroll(currentTop);
}
}
super.onFocus(direction);
}

Regular Contributor
galeb
Posts: 77
Registered: ‎11-03-2009
My Device: 9810 Torch

Re: Scroll happening but Vertical Field Manager Not Moving

If you are still having troubles with the fields not being accesible, did you try invalidateing the main manager?

Regular Contributor
meanman
Posts: 61
Registered: ‎08-25-2010
My Device: Torch 9800

Re: Scroll happening but Vertical Field Manager Not Moving

There is something really strange in that for the focused field to become fully visible the field with focus must extends to the edge of the "row" manager. Try it by creating a vertical field manager, add custom "rows" which are managers and each one contains two fields. First set only the left field to focusable. Notice how the scrolling doesn't work. Set both to focusable and observe that it works.

 

So my solution to this problem is:

create a field called FakeField. When layouting the "row" ensure the fake field is set to position 0,0 and has the same width and height as the manager. This should be your only focusable field. This has fixed it for me.