Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Menubar disappears if setted at runtime
Menubar disappears if setted at runtime [message #126018] Mon, 23 March 2009 17:21 Go to next message
Enrico Zanaga is currently offline Enrico ZanagaFriend
Messages: 50
Registered: July 2009
Member
Hi,

in RAP 1.2M6 if the menubar of a shell is setted at runtime the menu
disappears. If the shell is width-resized then the menu appears.

Here's the snippet:

public class RapTest implements IEntryPoint {

@Override
public int createUI() {
Display d = new Display();
final Shell s = new Shell(d);
s.setSize(800, 600);
s.setMenuBar(getMenu(s));

Button b = new Button(s, SWT.PUSH);
b.setText("Menu");
b.setBounds(100, 100, 100, 100);
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Menu m1 = getMenu(s);
s.setMenuBar(m1);
}
});

s.open();
while( !s.isDisposed() )
if( !d.readAndDispatch() )
d.sleep();

s.dispose();
d.dispose();
return 0;
}

private Menu getMenu(Shell s) {
Menu menu = new Menu(s, SWT.BAR);
Random r = new Random();
int menuCount = 1 + r.nextInt(10);
for( int i = 0; i < menuCount; i++ ) {
MenuItem m1 = new MenuItem(menu, SWT.CASCADE);
m1.setText(String.valueOf('A' + r.nextInt(26)));
Menu m3 = new Menu(m1);
m1.setMenu(m3);

int popupCount = 1 + r.nextInt(10);
for( int j = 0; j < popupCount; j++ ) {
MenuItem m2 = new MenuItem(m3, SWT.NONE);
m2.setText(String.valueOf('A' + r.nextInt(26)));
}
}
return menu;
}
}



Thanks
Enrico
Re: Menubar disappears if setted at runtime [message #126032 is a reply to message #126018] Mon, 23 March 2009 19:12 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2396
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Enrico,

thanks for pointing this out. This regression was introduced in M6 by
fixing the bug 264819: "MenuBar property "menuBarShellClientArea" not
preserved". Now it is fixed in CVS HEAD.

Best,
Ivan

Enrico Zanaga wrote:
> Hi,
>
> in RAP 1.2M6 if the menubar of a shell is setted at runtime the menu
> disappears. If the shell is width-resized then the menu appears.
>
> Here's the snippet:
>
> public class RapTest implements IEntryPoint {
>
> @Override
> public int createUI() {
> Display d = new Display();
> final Shell s = new Shell(d);
> s.setSize(800, 600);
> s.setMenuBar(getMenu(s));
>
> Button b = new Button(s, SWT.PUSH);
> b.setText("Menu");
> b.setBounds(100, 100, 100, 100);
> b.addSelectionListener(new SelectionAdapter() {
> @Override
> public void widgetSelected(SelectionEvent e) {
> Menu m1 = getMenu(s);
> s.setMenuBar(m1);
> }
> });
>
> s.open();
> while( !s.isDisposed() )
> if( !d.readAndDispatch() )
> d.sleep();
>
> s.dispose();
> d.dispose();
> return 0;
> }
>
> private Menu getMenu(Shell s) {
> Menu menu = new Menu(s, SWT.BAR);
> Random r = new Random();
> int menuCount = 1 + r.nextInt(10);
> for( int i = 0; i < menuCount; i++ ) {
> MenuItem m1 = new MenuItem(menu, SWT.CASCADE);
> m1.setText(String.valueOf('A' + r.nextInt(26)));
> Menu m3 = new Menu(m1);
> m1.setMenu(m3);
>
> int popupCount = 1 + r.nextInt(10);
> for( int j = 0; j < popupCount; j++ ) {
> MenuItem m2 = new MenuItem(m3, SWT.NONE);
> m2.setText(String.valueOf('A' + r.nextInt(26)));
> }
> }
> return menu;
> }
> }
>
>
>
> Thanks
> Enrico
Previous Topic:Image from hard drive
Next Topic:Local file as icon in qooxdoo tree
Goto Forum:
  


Current Time: Sun Jan 29 07:14:08 GMT 2023

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

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

Back to the top