BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-22-2010, 12:19 AM   #1
vladt
New Member
 
Join Date: Jul 2010
Model: 9630
PIN: N/A
Carrier: Verizon
Posts: 11
Default hide default menu items

Please Login to Remove!

Hi. I want to display context menu without default items in it. It does not seem to matter that I erase the list, the default items (Close, Switch Application, Show Keyboard) do not disappear. Here's couple variations of the code.

private MenuItem mnuNewAcct=new MenuItem("New Account", 1, 10) {
public void run() {
//
}
};

protected void makeMenu(Menu menu, int context) {
menu.deleteAll();
menu.add(mnuNewAcct);
super.makeMenu(menu, context);
}

/***** OR *****/

protected void makeContextMenu(ContextMenu contextMenu) {
contextMenu.clear();
contextMenu.addItem(mnuNewAcct);
super.makeContextMenu(contextMenu);
}


protected boolean navigationClick(int status, int time) {
ContextMenu menu = this.getScreen().getContextMenu();
makeContextMenu(menu);
this.getScreen().onMenu(0);
return true;
}
Offline  
Old 07-22-2010, 01:23 AM   #2
nanika
Knows Where the Search Button Is
 
Join Date: Mar 2008
Location: Paris, France
Model: None
PIN: N/A
Carrier: None
Posts: 36
Default

As long as you call the "super" methods last you'll get the default entries, of course!
Offline  
Old 07-22-2010, 01:51 AM   #3
vladt
New Member
 
Join Date: Jul 2010
Model: 9630
PIN: N/A
Carrier: Verizon
Posts: 11
Default

Sorry, I should have removed it from the example. It does not make any difference if I have super or not. When I don't have it, the default menu items are added anyway. By the way, I'm on JDE 5.0, 9530 SIM. Thanks.
Offline  
Old 07-22-2010, 05:59 PM   #4
vladt
New Member
 
Join Date: Jul 2010
Model: 9630
PIN: N/A
Carrier: Verizon
Posts: 11
Default

To close the loop on this. The only way I was able to get rid of the default items on the menu was to subclass Menu into my own class and instantiate and show that. No matter what I tried with the default menu, it would always add the Switch Application and Show Keyboard items to the end of it.
Offline  
Closed Thread



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


Vintage Print Block “ Apple Corer Kitchen Tool “ Copper Face Block picture

Vintage Print Block “ Apple Corer Kitchen Tool “ Copper Face Block

$79.99



Lot of 6 Vintage Apple Drawstring Bags For iPhone, Mac, Apple Watch, iPod picture

Lot of 6 Vintage Apple Drawstring Bags For iPhone, Mac, Apple Watch, iPod

$45.00



Retro 1951 Apple Computer Logo 0.7mm Ballpoint Black Ink Pen Gold Barrel picture

Retro 1951 Apple Computer Logo 0.7mm Ballpoint Black Ink Pen Gold Barrel

$56.41



Vintage Red Apple Six Drawer Storage Organizer File Cabinet  picture

Vintage Red Apple Six Drawer Storage Organizer File Cabinet

$35.00



Vintage  Rainbow Logo Apple Post-It Sticky Notes 4

Vintage Rainbow Logo Apple Post-It Sticky Notes 4" Rare computer collectible

$39.99



VINTAGE 1994 Apple Black Toner Laser Writer Cartridge M 2473 G/A NEW SEALED picture

VINTAGE 1994 Apple Black Toner Laser Writer Cartridge M 2473 G/A NEW SEALED

$25.95







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