Here's a very small code snippet which shows the problem:

@Override
    public void onModuleLoad() {

        SimplePanel sp = new SimplePanel();
        DecoratedPopupPanel p = new DecoratedPopupPanel();
        p.setSize("300", "200");
        p.center();

        DOM.setIntStyleAttribute(p.getElement(), "zIndex", 99);

        MenuBar mb = new MenuBar();
        MenuBar sub = new MenuBar();
        MenuItem it = new MenuItem("Sub 1", new Command() {

            @Override
            public void execute() {
                Window.alert("clicked");
            }
        });
        sub.addItem(it);
        mb.addItem(new MenuItem("Test", sub));
        p.add(mb);

        p.show();

        RootPanel.get().add(sp);
    }

On 22 Feb., 09:28, Musicman75 <[email protected]> wrote:
> Hello,
>
> any solutions to handle zindex in menu/submenu?
> I don't want to create my own menu class to handle this issue.
>
> Thanks
>
> On 26 Jan., 14:40, Musicman75 <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > I have a multi layer application and try to use a menubar with
> > submenus.
> > The menubar itself is displayed on to after setting the zIndex, but
> > the submenus are created behind my other components.
>
> > I tried to set the zIndex on the submenu items, but the setting seems
> > to be ignored.
> > Only in IE it works correctly, in FF and Chrome the submenu is
> > displayed with the wrong zIndex.
>
> > Here's a small code snippet how I create the menu in my popup and set
> > the zIndex:
>
> > protected void showPopup(CodeViewerDto value, int x, int y) {
> >         int layer = indexOfTopWindow() + 1;
> >         DOM.setIntStyleAttribute(popup.getElement(), "zIndex", layer +
> > 20);
> >         popup.setWidth("150px");
> >         MenuBar menu = new MenuBar(true);
> >         MenuItem item = null;
> >         DOM.setIntStyleAttribute(menu.getElement(), "zIndex", layer +
> > 30);
>
> >         popup.setWidget(menu);
> >         int left = 0;
> >         int top = 0;
> >         popup.setPopupPosition(left, top);
> >         popup.show();
>
> >         Map<String, MenuBar> submenus = new HashMap<String,
> > MenuBar>();
> >         for (LineMarker lm : value.getLineMarkers()) {
> >             MenuBar submenu;
> >             if (submenus.containsKey(lm.getViolationType())) {
> >                 submenu = submenus.get(lm.getViolationType());
> >             } else {
> >                 submenu = new MenuBar();
> >                 submenus.put(lm.getViolationType(), submenu);
> >             }
>
> >             SafeHtmlBuilder sb = new SafeHtmlBuilder();
> >             sb.appendEscaped(lm.getMessage());
> >             MenuItem item2 = new MenuItem(sb.toSafeHtml());
> >             submenu.addItem(item2);
> >         }
> >         for (String s : submenus.keySet()) {
> >             MenuBar submenu = submenus.get(s);
> >             DOM.setIntStyleAttribute(submenu.getElement(), "zIndex",
> > layer + 40);
> >             item = new MenuItem(s, submenu);
> >             DOM.setIntStyleAttribute(item.getElement(), "zIndex",
> > layer + 50);
> >             menu.addItem(item);
> >         }
> >     }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to