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
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified
Accepted Solution

Making menu in PopupScreen

Hi guys'

I need to make menu for my application. I made menus for MainScreen and this screen includes PopupScreen.

When push PopupScreen, the menu doesn't appear on screen. I want to appear the menus when push PopupScreen.

 

Is it possible to make menus for PopupScreen ?

 

Plz share knowledge.

 

Tnx'

Please use plain text.
Developer
saravanaboopati
Posts: 147
Registered: ‎09-10-2008
My Device: Not Specified

Re: Making menu in PopupScreen

I think PopupScreen don't support menu items.

 

Please use plain text.
New Developer
irlennard
Posts: 3
Registered: ‎07-22-2008
My Device: Not Specified

Re: Making menu in PopupScreen

It is possible. In your constructor make sure you specify DEFAULT_MENU. Then just override the the makeMenu function:

 

 

public void makeMenu(Menu menu, int instance)
{

if (instance == Menu.INSTANCE_DEFAULT)
{

// Add your menus here.

// menu.add(...);

}

super.makeMenu(menu, instance);
}

 

-- Ian
Please use plain text.
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: Making menu in PopupScreen

[ Edited ]

Tnx for your advice'

 

I've tried your code. But the menu doesn't appear on the screen. 

 

Is it really impossible to make menus for PopupScreen ?

 

What do other dear advisors think ?

 

 

Message Edited by Raiden on 10-23-2008 06:04 AM
Please use plain text.
New Developer
irlennard
Posts: 3
Registered: ‎07-22-2008
My Device: Not Specified

Re: Making menu in PopupScreen

It definitely works because I've done it before. Try also specifying DEFAULT_CLOSE. Just to be sure you're doing it right here is a basic class:

 

 

class MyPopup extends PopupScreen { MyPopup() { super(new VerticalFieldManager(), DEFAULT_MENU|DEFAULT_CLOSE); } public void makeMenu(Menu menu, int instance) { if (instance == Menu.INSTANCE_DEFAULT) { menu.add(_myItem); } super.makeMenu(menu, instance); } protected MenuItem _myItem = new MenuItem("My Item", 100, 10) { public void run() { // do something here } };

}

 

 

 

Please use plain text.
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: Making menu in PopupScreen

It is cool. Working fine. Tnx a lot' Irlennard
Please use plain text.