BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-23-2009, 09:48 AM   #1
itp
Knows Where the Search Button Is
 
Join Date: Jul 2008
Model: none
PIN: N/A
Carrier: none
Posts: 24
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  
Old 05-23-2009, 02:51 PM   #2
itp
Knows Where the Search Button Is
 
Join Date: Jul 2008
Model: none
PIN: N/A
Carrier: none
Posts: 24
Default

I was able to solve this by using a FieldChangeListener like this. But it seems like a cludgy solution. Any better ideas?

Quote:
b1 = new ButtonField("Goto Screen B",ButtonField.CONSUME_CLICK);
b1.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field, int context)
{
MenuButtonScreenB sc = new MenuButtonScreenB();
UiApplication.getUiApplication().pushScreen(sc);
}
});
this.add(b1);
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.*;
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.component.*;

public class 
MenuButtonScreenA extends MainScreen 
{
    private 
ButtonField b1,b2;
    private 
ButtonField buttonSel;
    
    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("Goto Screen B",ButtonField.CONSUME_CLICK);
        
b1.setChangeListener(new FieldChangeListener()
        {
            public 
void fieldChanged(Field fieldint context)
            {
                
MenuButtonScreenB sc = new MenuButtonScreenB();
                
UiApplication.getUiApplication().pushScreen(sc);
            }
        });
        
this.add(b1);
        
//--------------        
        
b2 = new ButtonField("Goto Screen C",ButtonField.CONSUME_CLICK);
        
b2.setChangeListener(new FieldChangeListener()
        {
            public 
void fieldChanged(Field fieldint context)
            {
                
MenuButtonScreenC sc = new MenuButtonScreenC();
                
UiApplication.getUiApplication().pushScreen(sc);
            }
        });
        
this.add(b2);
        
//--------------
        
    
}
    

  
//override the onClose() method to display a dialog box to the user with "Goodbye!" when the application is closed
   
public boolean onClose()
   {       
       
boolean retval false;
       
int response Dialog.ask(Dialog.D_YES_NO"Are you sure you want to Exit now?"Dialog.NO);     
       if(
response==Dialog.YES)
       {                
           
System.exit(0);
           
retval true;       
       }       
       return 
retval;
   }   
}

import net.rim.device.api.ui.*;
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.component.*;


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

    public 
MenuButtonScreenB()
    {
        
super(DEFAULT_MENU);
        
LabelField title = new LabelField("Menu Button Test Screen -B1-" ,LabelField.ELLIPSIS |  LabelField.USE_ALL_WIDTH); 
        
setTitle(title);           
         
        
//--------------
        
b1 = new ButtonField("Goto Screen B-1",ButtonField.CONSUME_CLICK);
        
b1.setChangeListener(new FieldChangeListener()
        {
            public 
void fieldChanged(Field fieldint context)
            {
                
Dialog.alert("This will soon take you to Screen B-1");
            }
        });
        
this.add(b1);
    }
    
    public 
boolean onClose()
    {  
       
setDirty(false);
       return 
super.onClose();
   }       
}

import net.rim.device.api.ui.*;
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 
MenuButtonScreenC extends MainScreen
{
    private 
ButtonField b1,b2;

    public 
MenuButtonScreenC()
    {
        
super(DEFAULT_MENU);                                
        
LabelField title = new LabelField("Menu Button Test Screen -C1-" ,LabelField.ELLIPSIS |  LabelField.USE_ALL_WIDTH); 
        
setTitle(title);           
         
        
//--------------
        
b1 = new ButtonField("Goto Screen C-1",ButtonField.CONSUME_CLICK);
        
b1.setChangeListener(new FieldChangeListener()
        {
            public 
void fieldChanged(Field fieldint context)
            {
                
Dialog.alert("This will soon take you to Screen C-1");
            }
        });
        
this.add(b1);
    }
    
    public 
boolean onClose()
    {  
       
setDirty(false);
       return 
super.onClose();
   }       

Offline  
Old 05-24-2009, 01:25 PM   #3
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

You could have added the CONSUME_CLICK style to your button field - this would keep the menu from poppin up.
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


emergency power transfer switch non fused generator manual ge 100 amp 240 volt picture

emergency power transfer switch non fused generator manual ge 100 amp 240 volt

$185.89



ABB Controller Door Interlock Switch 3HAC8367-1 picture

ABB Controller Door Interlock Switch 3HAC8367-1

$149.95



NEW Fan/Limit Control Switch of Honeywell L4064B2210 11

NEW Fan/Limit Control Switch of Honeywell L4064B2210 11" IN BOX

$97.00



Omron Switch D4SL-N2EFG-D D4SL-N2FFA-D D4SL-N2FFG-D D4SL-N2HFA-D D4SL-N2NFA-D picture

Omron Switch D4SL-N2EFG-D D4SL-N2FFA-D D4SL-N2FFG-D D4SL-N2HFA-D D4SL-N2NFA-D

$167.19



5X Toggle SWITCH ON/OFF Heavy Duty 15A 250V SPST 2 Terminal Car Boat* Waterproof picture

5X Toggle SWITCH ON/OFF Heavy Duty 15A 250V SPST 2 Terminal Car Boat* Waterproof

$8.29



Starter Switch Fits FARMALL H HV M MD O4 OS4 OS6 WD6 W4 W6 picture

Starter Switch Fits FARMALL H HV M MD O4 OS4 OS6 WD6 W4 W6

$17.99







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