Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700
Accepted Solution

OverRide RIM MakeMenu, does not allow user to add some Separator on customized menu.

As title,

 

I want to insert a Separator between two menuitems, however, I have no luck.

 

here is my test code:

 

 

import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.system.*; import net.rim.device.api.servicebook.*; import net.rim.device.api.ui.container.*; /** * */ public class BackDoorTest extends UiApplication{ public static void main(String args[]){ UiApplication theApp = new BackDoorTest(); theApp.enterEventDispatcher(); } public BackDoorTest() { pushScreen(new TScreen()); } class TScreen extends MainScreen { private VerticalFieldManager vfm; public TScreen() { super(); this.add(new LabelField("BackDoorSequenceTest")); } protected void makeMenu(Menu menu, int instance) { super.makeMenu(menu,instance); MenuItem m1 = new MenuItem("one and two has Separator",100,0) { public void run() { Dialog.alert("menu one"); } }; menu.add(m1); menu.addSeparator(); MenuItem m2 = new MenuItem("two menu",100,2) { public void run() { Dialog.alert("menu two"); } }; menu.add(m2); } public void close() { UiApplication.getUiApplication().requestBackground(); } public boolean openProductionBackdoor(int backdoorCode) { switch(backdoorCode) { case ('L'<<16)|('O'<<8)|('G'): pushScreen(new AScreen()); return true; } return super.openProductionBackdoor(backdoorCode); } } class AScreen extends MainScreen { AScreen() { super(); add(new LabelField("AScreen")); } } }

 

Developer
Posts: 19,629
Registered: ‎07-14-2008
My Device: Not Specified

Re: OverRide RIM MakeMenu, does not allow user to add some Separator on customized menu.

Try:

menu.add(MenuItem.separator(100));

 

in place of:

menu.addSeparator();

Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: OverRide RIM MakeMenu, does not allow user to add some Separator on customized menu.

Thanks

 

Developer
Posts: 16,679
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: OverRide RIM MakeMenu, does not allow user to add some Separator on customized menu.

here is a link from my vast knowledge base about it that may be helpful.
http://www.slashdev.ca/2008/05/07/menuitem-demystified/
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter