BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-20-2007, 03:11 PM   #1 (permalink)
New Member
 
Join Date: Aug 2007
Model: 8300
PIN: N/A
Carrier: Cingular
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Super simple(?) newbie nextFocus question

Please Login to Remove!

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!

Code:
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();
        theApp.enterEventDispatcher();
    }
    
    FocusTest() {
        pushScreen(new FocusTestMainScreen());
    }
} 

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

        vfm.add(new LabelField("Hello",Field.FOCUSABLE));
        vfm.add(new LabelField("world!",Field.FOCUSABLE));
        add(vfm);
    }
}
Offline  
Old 11-26-2007, 01:47 PM   #2 (permalink)
New Member
 
Join Date: Aug 2007
Model: 8300
PIN: N/A
Carrier: Cingular
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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!!
Offline  
Old 06-19-2008, 02:57 AM   #3 (permalink)
New Member
 
Join Date: Jun 2008
Model: 8700
PIN: N/A
Carrier: AT&T
Posts: 6
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Offline  
Old 06-19-2008, 10:04 AM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's a brief explanation that I posted on the RIM dev forums recently. HTH.
__________________
Do your homework and know how to ask a good question.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.