Skip to main content



      Home
Home » Eclipse Projects » Technology Project and PMC » SubMenu in PopUp Menu
SubMenu in PopUp Menu [message #54576] Sat, 24 May 2003 19:07 Go to next message
Eclipse UserFriend
Hi,

I want to have submenu in a PopUp Menu.I have created the SWT menu using
the menu class(org.eclipse.swt.widgets.Menu).I tried creating sub menu by
giving parent menu as argument but it doesn't show up.I also tried by giving
menu item as argument still I am not able to get it.I also tried setting
Menu.setVisible(true) but in vain.

How to do solve this problem.

Here is the snippet

//snippet

public RateManagerPocD220503V01PopUp(final Composite parent, final
RateManagerPocD220503V01Book editorBook) {


menu = new Menu(parent.getShell(),SWT.POP_UP);



cut = new MenuItem (menu, SWT.CASCADE);

clearContents = new MenuItem(menu,SWT.CASCADE);

subMenu = new Menu(clearContents);

subMenuItem = new MenuItem(subMenu,SWT.PUSH);


cut.setText("&Cut");

copy.setText("Copy");

clearContents.setText("Clear Contents");

parent.setMenu(menu);



}

//End of Snippet

MorPheus
Re: SubMenu in PopUp Menu [message #54658 is a reply to message #54576] Tue, 27 May 2003 12:39 Go to previous messageGo to next message
Eclipse UserFriend
One thing about SWT is that many components require that you call their
setter methods, not just create them with their parent component in the
constructor.

Right before calling parent.setMenu(menu), insert this line:
clearContents.setMenu(subMenu);

MorPheus wrote:
> Hi,
>
> I want to have submenu in a PopUp Menu.I have created the SWT menu using
> the menu class(org.eclipse.swt.widgets.Menu).I tried creating sub menu by
> giving parent menu as argument but it doesn't show up.I also tried by giving
> menu item as argument still I am not able to get it.I also tried setting
> Menu.setVisible(true) but in vain.
>
> How to do solve this problem.
>
> Here is the snippet
>
> //snippet
>
> public RateManagerPocD220503V01PopUp(final Composite parent, final
> RateManagerPocD220503V01Book editorBook) {
>
>
> menu = new Menu(parent.getShell(),SWT.POP_UP);
>
>
>
> cut = new MenuItem (menu, SWT.CASCADE);
>
> clearContents = new MenuItem(menu,SWT.CASCADE);
>
> subMenu = new Menu(clearContents);
>
> subMenuItem = new MenuItem(subMenu,SWT.PUSH);
>
>
> cut.setText("&Cut");
>
> copy.setText("Copy");
>
> clearContents.setText("Clear Contents");
>
> parent.setMenu(menu);
>
>
>
> }
>
> //End of Snippet
>
> MorPheus
>
>
>
>
>
>
>
Re: SubMenu in PopUp Menu [message #55030 is a reply to message #54576] Tue, 10 June 2003 02:52 Go to previous message
Eclipse UserFriend
There are some properties mandatory in setting up a submenu. Here is a
simple example.

Menu menu = new Menu(shell);

MenuItem itemOne = new MenuItem(menu, SWT.PUSH);
itemOne.setText("First");

// Should use the CASCADE style if it holds a submenu
MenuItem itemTwo = new MenuItem(menu, SWT.CASCADE);
itemTwo.setText("Second");


// Should be a DROP_DOWN in its style
Menu subMenu = new Menu(shell, SWT.DROP_DOWN);

MenuItem itemThree = new MenuItem(subMenu, SWT.PUSH);
itemThree.setText("SubMenu Item");
itemTwo.setMenu(subMenu);



"MorPheus" <rgurupackiam@selectica.com> wrote in message
news:baoth8$nbs$1@rogue.oti.com...
> Hi,
>
> I want to have submenu in a PopUp Menu.I have created the SWT menu
using
> the menu class(org.eclipse.swt.widgets.Menu).I tried creating sub menu by
> giving parent menu as argument but it doesn't show up.I also tried by
giving
> menu item as argument still I am not able to get it.I also tried setting
> Menu.setVisible(true) but in vain.
>
> How to do solve this problem.
>
> Here is the snippet
>
> //snippet
>
> public RateManagerPocD220503V01PopUp(final Composite parent, final
> RateManagerPocD220503V01Book editorBook) {
>
>
> menu = new Menu(parent.getShell(),SWT.POP_UP);
>
>
>
> cut = new MenuItem (menu, SWT.CASCADE);
>
> clearContents = new MenuItem(menu,SWT.CASCADE);
>
> subMenu = new Menu(clearContents);
>
> subMenuItem = new MenuItem(subMenu,SWT.PUSH);
>
>
> cut.setText("&Cut");
>
> copy.setText("Copy");
>
> clearContents.setText("Clear Contents");
>
> parent.setMenu(menu);
>
>
>
> }
>
> //End of Snippet
>
> MorPheus
>
>
>
>
>
>
>
Re: SubMenu in PopUp Menu [message #594031 is a reply to message #54576] Tue, 27 May 2003 12:39 Go to previous message
Eclipse UserFriend
One thing about SWT is that many components require that you call their
setter methods, not just create them with their parent component in the
constructor.

Right before calling parent.setMenu(menu), insert this line:
clearContents.setMenu(subMenu);

MorPheus wrote:
> Hi,
>
> I want to have submenu in a PopUp Menu.I have created the SWT menu using
> the menu class(org.eclipse.swt.widgets.Menu).I tried creating sub menu by
> giving parent menu as argument but it doesn't show up.I also tried by giving
> menu item as argument still I am not able to get it.I also tried setting
> Menu.setVisible(true) but in vain.
>
> How to do solve this problem.
>
> Here is the snippet
>
> //snippet
>
> public RateManagerPocD220503V01PopUp(final Composite parent, final
> RateManagerPocD220503V01Book editorBook) {
>
>
> menu = new Menu(parent.getShell(),SWT.POP_UP);
>
>
>
> cut = new MenuItem (menu, SWT.CASCADE);
>
> clearContents = new MenuItem(menu,SWT.CASCADE);
>
> subMenu = new Menu(clearContents);
>
> subMenuItem = new MenuItem(subMenu,SWT.PUSH);
>
>
> cut.setText("&Cut");
>
> copy.setText("Copy");
>
> clearContents.setText("Clear Contents");
>
> parent.setMenu(menu);
>
>
>
> }
>
> //End of Snippet
>
> MorPheus
>
>
>
>
>
>
>
Re: SubMenu in PopUp Menu [message #594206 is a reply to message #54576] Tue, 10 June 2003 02:52 Go to previous message
Eclipse UserFriend
There are some properties mandatory in setting up a submenu. Here is a
simple example.

Menu menu = new Menu(shell);

MenuItem itemOne = new MenuItem(menu, SWT.PUSH);
itemOne.setText("First");

// Should use the CASCADE style if it holds a submenu
MenuItem itemTwo = new MenuItem(menu, SWT.CASCADE);
itemTwo.setText("Second");


// Should be a DROP_DOWN in its style
Menu subMenu = new Menu(shell, SWT.DROP_DOWN);

MenuItem itemThree = new MenuItem(subMenu, SWT.PUSH);
itemThree.setText("SubMenu Item");
itemTwo.setMenu(subMenu);



"MorPheus" <rgurupackiam@selectica.com> wrote in message
news:baoth8$nbs$1@rogue.oti.com...
> Hi,
>
> I want to have submenu in a PopUp Menu.I have created the SWT menu
using
> the menu class(org.eclipse.swt.widgets.Menu).I tried creating sub menu by
> giving parent menu as argument but it doesn't show up.I also tried by
giving
> menu item as argument still I am not able to get it.I also tried setting
> Menu.setVisible(true) but in vain.
>
> How to do solve this problem.
>
> Here is the snippet
>
> //snippet
>
> public RateManagerPocD220503V01PopUp(final Composite parent, final
> RateManagerPocD220503V01Book editorBook) {
>
>
> menu = new Menu(parent.getShell(),SWT.POP_UP);
>
>
>
> cut = new MenuItem (menu, SWT.CASCADE);
>
> clearContents = new MenuItem(menu,SWT.CASCADE);
>
> subMenu = new Menu(clearContents);
>
> subMenuItem = new MenuItem(subMenu,SWT.PUSH);
>
>
> cut.setText("&Cut");
>
> copy.setText("Copy");
>
> clearContents.setText("Clear Contents");
>
> parent.setMenu(menu);
>
>
>
> }
>
> //End of Snippet
>
> MorPheus
>
>
>
>
>
>
>
Previous Topic:MultipageEditor-
Next Topic:Urgent : SWT_AWT not implemented on pocketpc?
Goto Forum:
  


Current Time: Sat Apr 26 23:56:13 EDT 2025

Powered by FUDForum. Page generated in 0.03327 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top