menu setvisible problem

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

menu setvisible problem

Postby kgregg » Thu Aug 19, 2010 9:45 am

Not sure if it is a WB issue, but when I build a simple menu and set visible to false:

final Menu menu = new Menu(shlHello, SWT.BAR);
shlHello.setMenuBar(menu);
MenuItem mntmfile = new MenuItem(menu, SWT.NONE);
mntmfile.setText("&File");
menu.setVisible(false);

The resulting menu still displays. If I replace setVisible(false) with setEnabled(false), it displays and is not enabled as I would expect. If I replace mntmfile.setText("&File") and menu.setVisible(false) with mntmfile.setText("") and menu.setEnabled(false) I can get the same effect as not visible, but if I do that I have to re-populate all of my menu items when I want it to display. The idea is that I have a stacklayer form, some layers having the menu and some without. Shouldn't setVisible work that way?

Thanks
kgregg
 
Posts: 14
Joined: Thu Aug 19, 2010 9:22 am

Re: menu setvisible problem

Postby Eric Clayberg » Thu Aug 19, 2010 10:05 am

The product intentionally ignores the visibility flag at design time to make it easier to actually lay out the windows and the menus.

If you are talking about a runtime effect, that would not be a WB issue.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: menu setvisible problem

Postby kgregg » Thu Aug 19, 2010 10:27 am

I'm talking primarily about a runtime effect, but runtime seems to mirror what happens at WB design time. That is, setVisible(false) doesn't seem to have an effect - either at design time or runtime. As an annoying related side-effect, if I manually code it for setVisible(false), the visible property shows up on the WB palette with false indicated as it should (although it doesn't seem to work even at runtime). If I click on false in the palette (setting it to true), the WB parser apparently deletes the setVisible code and the visible property disappears completely from the palette - so I can't re-set it to false without going to the source and manually re-entering my setVisible(false) code.
kgregg
 
Posts: 14
Joined: Thu Aug 19, 2010 9:22 am

Re: menu setvisible problem

Postby Eric Clayberg » Thu Aug 19, 2010 12:30 pm

kgregg wrote:If I click on false in the palette (setting it to true), the WB parser apparently deletes the setVisible code and the visible property disappears completely from the palette - so I can't re-set it to false without going to the source and manually re-entering my setVisible(false) code.

The "visible" property is advanced, so you need to turn on the advanced properties filter to see it all of the time.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

cron