Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Working example of RAP Menu Bar
Working example of RAP Menu Bar [message #126427] Tue, 31 March 2009 05:30 Go to next message
Eclipse UserFriend
Originally posted by: peterka.jiri.gmail.com

Hi all,

I'm unable to create classic SWT menu with this code:

Menu menuBar = new Menu(shell, SWT.POP_UP);

MenuItem fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
fileMenuHeader.setText("&File");

Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
fileMenuHeader.setMenu(fileMenu);
MenuItem fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
fileSaveItem.setText("&Save");

MenuItem fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
fileExitItem.setText("E&xit");

shell.setMenu(menuBar);


Could you help me to know what's wrong in this snippet of code? Or is
there Menu bar support in RAP at all?

Thanks

Jiri
Re: Working example of RAP Menu Bar [message #126440 is a reply to message #126427] Tue, 31 March 2009 07:04 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Jiri,

to create a menu bar use:
Menu menuBar = new Menu(shell, SWT.BAR);

Best,
Ivan

Jiri Peterka wrote:
> Hi all,
>
> I'm unable to create classic SWT menu with this code:
>
> Menu menuBar = new Menu(shell, SWT.POP_UP);
>
> MenuItem fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
> fileMenuHeader.setText("&File");
>
> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
> fileMenuHeader.setMenu(fileMenu);
> MenuItem fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
> fileSaveItem.setText("&Save");
>
> MenuItem fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
> fileExitItem.setText("E&xit");
>
> shell.setMenu(menuBar);
>
>
> Could you help me to know what's wrong in this snippet of code? Or is
> there Menu bar support in RAP at all?
>
> Thanks
>
> Jiri
Re: Working example of RAP Menu Bar [message #126453 is a reply to message #126440] Tue, 31 March 2009 07:09 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
.... and don't forget to change:
shell.setMenuBar( menuBar );

Here is a complete working example:
--------------------
Menu menuBar = new Menu(shell, SWT.BAR);
MenuItem fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
fileMenuHeader.setText("&File");
Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
fileMenuHeader.setMenu(fileMenu);
MenuItem fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
fileSaveItem.setText("&Save");
MenuItem fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
fileExitItem.setText("E&xit");
shell.setMenuBar(menuBar);
--------------------

Best,
Ivan



Ivan Furnadjiev wrote:
> Hi Jiri,
>
> to create a menu bar use:
> Menu menuBar = new Menu(shell, SWT.BAR);
>
> Best,
> Ivan
>
> Jiri Peterka wrote:
>> Hi all,
>>
>> I'm unable to create classic SWT menu with this code:
>>
>> Menu menuBar = new Menu(shell, SWT.POP_UP);
>>
>> MenuItem fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
>> fileMenuHeader.setText("&File");
>>
>> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
>> fileMenuHeader.setMenu(fileMenu);
>> MenuItem fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
>> fileSaveItem.setText("&Save");
>>
>> MenuItem fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
>> fileExitItem.setText("E&xit");
>> shell.setMenu(menuBar);
>>
>>
>> Could you help me to know what's wrong in this snippet of code? Or is
>> there Menu bar support in RAP at all?
>>
>> Thanks
>>
>> Jiri
Re: Working example of RAP Menu Bar [message #126522 is a reply to message #126453] Tue, 31 March 2009 10:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: peterka.jiri.gmail.com

Hi Ivan,

your code works great. Thanks for help

Best regards

Jiri

Ivan Furnadjiev wrote:
> ... and don't forget to change:
> shell.setMenuBar( menuBar );
>
> Here is a complete working example:
> --------------------
> Menu menuBar = new Menu(shell, SWT.BAR);
> MenuItem fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
> fileMenuHeader.setText("&File");
> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
> fileMenuHeader.setMenu(fileMenu);
> MenuItem fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
> fileSaveItem.setText("&Save");
> MenuItem fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
> fileExitItem.setText("E&xit");
> shell.setMenuBar(menuBar);
> --------------------
>
> Best,
> Ivan
>
>
>
> Ivan Furnadjiev wrote:
>> Hi Jiri,
>>
>> to create a menu bar use:
>> Menu menuBar = new Menu(shell, SWT.BAR);
>>
>> Best,
>> Ivan
>>
>> Jiri Peterka wrote:
>>> Hi all,
>>>
>>> I'm unable to create classic SWT menu with this code:
>>>
>>> Menu menuBar = new Menu(shell, SWT.POP_UP);
>>>
>>> MenuItem fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
>>> fileMenuHeader.setText("&File");
>>>
>>> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
>>> fileMenuHeader.setMenu(fileMenu);
>>> MenuItem fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
>>> fileSaveItem.setText("&Save");
>>>
>>> MenuItem fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
>>> fileExitItem.setText("E&xit");
>>> shell.setMenu(menuBar);
>>>
>>>
>>> Could you help me to know what's wrong in this snippet of code? Or is
>>> there Menu bar support in RAP at all?
>>>
>>> Thanks
>>>
>>> Jiri
Re: Working example of RAP Menu Bar [message #126606 is a reply to message #126522] Tue, 31 March 2009 15:21 Go to previous message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
Hi,

just a little follow up to this. SWT already provides several snippets
how to use SWT widgets. You may take a look there if you're interested:
http://www.eclipse.org/swt/snippets/

Cheers
Benny

Jiri Peterka wrote:
> Hi Ivan,
>
> your code works great. Thanks for help
>
> Best regards
>
> Jiri
>
> Ivan Furnadjiev wrote:
>> ... and don't forget to change:
>> shell.setMenuBar( menuBar );
>>
>> Here is a complete working example:
>> --------------------
>> Menu menuBar = new Menu(shell, SWT.BAR);
>> MenuItem fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
>> fileMenuHeader.setText("&File");
>> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
>> fileMenuHeader.setMenu(fileMenu);
>> MenuItem fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
>> fileSaveItem.setText("&Save");
>> MenuItem fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
>> fileExitItem.setText("E&xit");
>> shell.setMenuBar(menuBar);
>> --------------------
>>
>> Best,
>> Ivan
>>
>>
>>
>> Ivan Furnadjiev wrote:
>>> Hi Jiri,
>>>
>>> to create a menu bar use:
>>> Menu menuBar = new Menu(shell, SWT.BAR);
>>>
>>> Best,
>>> Ivan
>>>
>>> Jiri Peterka wrote:
>>>> Hi all,
>>>>
>>>> I'm unable to create classic SWT menu with this code:
>>>>
>>>> Menu menuBar = new Menu(shell, SWT.POP_UP);
>>>>
>>>> MenuItem fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
>>>> fileMenuHeader.setText("&File");
>>>>
>>>> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
>>>> fileMenuHeader.setMenu(fileMenu);
>>>> MenuItem fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
>>>> fileSaveItem.setText("&Save");
>>>>
>>>> MenuItem fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
>>>> fileExitItem.setText("E&xit");
>>>> shell.setMenu(menuBar);
>>>>
>>>>
>>>> Could you help me to know what's wrong in this snippet of code? Or
>>>> is there Menu bar support in RAP at all?
>>>>
>>>> Thanks
>>>>
>>>> Jiri
Previous Topic:problem with the height of TableViewerColumn and ComboBoxCellEditor
Next Topic:Highlight a single cell
Goto Forum:
  


Current Time: Mon Dec 06 11:34:47 GMT 2021

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

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

Back to the top