View Single Post
Old 05-23-2009, 09:48 AM   #1 (permalink)
itp
Knows Where the Search Button Is
 
Join Date: Jul 2008
Model: none
PIN: N/A
Carrier: none
Posts: 24
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default BB screen navigation issues - <FULL MENU> <HOLD>

Please Login to Remove!

I am trying to build a simple menu using ButtonFields. I am able to navigate from screen to screen.

Testing on the emulator, if I use the "Enter Button" or Enter key on my beyboard, I can navigate from Screen A to Screen B. However if I use the Pearl trackball, I get I get <Full Menu> and then <Close> menu options.

What technique can I use to skip these menu options in an application. I also tried variations of super(DEFAULT_MENU | DEFAULT_CLOSE), with no success.

Please respond gently, as I am still quite new with this.

thank you


PHP Code:
import net.rim.device.api.ui.Screen;
import net.rim.device.api.ui.UiApplication;

class 
MenuMain extends UiApplication
{
   public static 
void main(Stringxxx91;xxx93; args)    
   {  
        
MenuMain theApp = new MenuMain();
        
theApp.enterEventDispatcher();       
   } 
   public 
MenuMain()   
   {
       
pushScreen(new MenuButtonScreenA());   
   }   
}

import net.rim.device.api.ui.Screen;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;

public class 
MenuButtonScreenA extends MainScreen implements FieldChangeListener
{
    private 
ButtonField b1,b2;
    public 
MenuButtonScreenA()
    {
        
super(DEFAULT_MENU);
        
LabelField title = new LabelField("Menu Button Test Screen -A-" ,LabelField.ELLIPSIS |  LabelField.USE_ALL_WIDTH); 
        
setTitle(title);           
         
        
b1 = new ButtonField("Go To Screen B");    
        
b2 = new ButtonField("Go To Screen C");       
        
this.add(b1);
        
this.add(b2);
        
b1.setChangeListener(this);
        
b2.setChangeListener(this);
    }
   
    public 
void fieldChanged(Field fieldint context)
    {
         if(
field instanceof ButtonField)
         {        
             
String lbl = ((ButtonField)field).getLabel();
        
             if(
lbl.equals("Go To Screen B"))
             {   
                 
MenuButtonScreenB sc = new MenuButtonScreenB();
                 
UiApplication.getUiApplication().pushScreen(sc);
             }
             
             if(
lbl.equals("Go To Screen C"))
             {
                 
Dialog.alert("This will soon take you to Screen C");
                 
//MenuButtonScreenC sc = new MenuButtonScreenC();
                 //UiApplication.getUiApplication().pushScreen(sc);
             
}
        }   
    }

  
//override the onClose() method to display a dialog box to the user with "Goodbye!" when the application is closed
   
public boolean onClose()
   {
       
Dialog.alert("Goodbye!");
       
System.exit(0);
       return 
true;
   }
}

 
import net.rim.device.api.ui.Screen;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;

public class 
MenuButtonScreenB extends MainScreen implements FieldChangeListener
{
    private 
ButtonField b1,b2;

    public 
MenuButtonScreenB()
    {
        
super(DEFAULT_MENU);
        
LabelField title = new LabelField("Menu Button Test Screen -B-" ,LabelField.ELLIPSIS |  LabelField.USE_ALL_WIDTH); 
        
setTitle(title);           
         
        
b1 = new ButtonField("Go To Screen B-1");    
        
b2 = new ButtonField("Go To Screen B-2");       
        
this.add(b1);
        
this.add(b2);
        
b1.setChangeListener(this);
        
b2.setChangeListener(this);         
    }
    
    public 
void fieldChanged(Field fieldint context)
    {
         if(
field instanceof ButtonField)
         {        
             
String lbl = ((ButtonField)field).getLabel();
        
             if(
lbl.equals("Go To Screen B-1"))
             {            
                 
Dialog.alert("This will soon take you to Screen B-1");
                 
//MenButtonScreenB sc = new MenButtonScreenB();
                 //UiApplication.getUiApplication().pushScreen(sc);
             
}
             
             if(
lbl.equals("Go To Screen B-2"))
             {
                 
Dialog.alert("This will soon take you to Screen B-2");
                 
//MenButtonScreenC sc = new MenButtonScreenC();
                 //UiApplication.getUiApplication().pushScreen(sc);
             
}
        }   
    }    
    
    public 
boolean onClose()
    {  
       
setDirty(false);
       return 
super.onClose();
   }    

Offline   Reply With Quote