BlackBerry Forums Support Community

BlackBerry Forums Support Community (
-   Developer Forum (
-   -   Super simple(?) newbie nextFocus question (

cybrown 11-20-2007 04:11 PM

Super simple(?) newbie nextFocus question
I'm creating a custom manager, and I'm baffled by why my focus handling doesn't work. Rather than post the entire program, I've written a quick test app that baffles me as well. Why doesn't this application produce a dialog? It looks like the nextFocus() method never gets called. Please help!


package FocusTest;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.system.*;

class FocusTest extends UiApplication{
    public static void main(String args[]){
        FocusTest theApp = new FocusTest();
    FocusTest() {
        pushScreen(new FocusTestMainScreen());

class FocusTestMainScreen extends MainScreen{
    VerticalFieldManager vfm;
        vfm = new VerticalFieldManager(){
            protected int nextFocus(int direction, boolean alt){
                Dialog.alert("Focus change!");
                return super.nextFocus(direction,alt);

        vfm.add(new LabelField("Hello",Field.FOCUSABLE));
        vfm.add(new LabelField("world!",Field.FOCUSABLE));

cybrown 11-26-2007 02:47 PM

After some digging around on the RIM message boards, I found a VERY brief note that the function was changed to:
nextFocus(int direction, int n)

When I override this function, I instantly get the results I want, but I can't find it ANYWHERE in the documentation. Did anyone here know that already, and can anyone tell me what the mysterious "int n" represents? Thanks!!

haagmm 06-19-2008 02:57 AM

So i hope you found the answer out by now, but since google took me here and you answered my question, as far as i can tell alt is 1 for a horizontal move of the trackball and 2 for a vertical move.

i cant get my tether to an 8700 to work right so i cant tell you what it does on a track wheal

richard.puckett 06-19-2008 10:04 AM

Here's a brief explanation that I posted on the RIM dev forums recently. HTH.

All times are GMT -5. The time now is 04:13 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.