BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-22-2010, 12:19 AM   #1 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9630
PIN: N/A
Carrier: Verizon
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
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 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2008
Location: Paris, France
Model: None
PIN: N/A
Carrier: None
Posts: 36
Post Thanks: 0
Thanked 0 Times in 0 Posts
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 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9630
PIN: N/A
Carrier: Verizon
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
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 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9630
PIN: N/A
Carrier: Verizon
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
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


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.