Hello GWTer:

I am new to GWT, so please help.

I can not get cascade menuBar and rootLayoutPanel/DockLayoutPanel to
work. The cascade (second level) menubars do not display. The codes
below compile with GWT 2.0.3 and GWT 2.1.M2. The same menus work and
display properly when I used RootPanel or DockPanel.

Please help,
Jim


======================================
public void onModuleLoad() {
                // Make a command that we will execute from all leaves.
            Command cmd = new Command() {
              public void execute() {
                Window.alert("You selected a menu item!");
              }
            };

            // Make some sub-menus that we will cascade from the top menu.
            MenuBar fooMenu = new MenuBar(true);
            fooMenu.addItem("thefoo", cmd);
            fooMenu.addItem("foo", cmd);
            fooMenu.addItem("menu", cmd);

            MenuBar barMenu = new MenuBar(true);
            barMenu.addItem("thebar", cmd);
            barMenu.addItem("bar", cmd);
            barMenu.addItem("menu", cmd);

            MenuBar bazMenu = new MenuBar(true);

            bazMenu.addItem("thebaz", cmd);
            bazMenu.addItem("baz", cmd);
            bazMenu.addItem("menu", cmd);

            // Make a new menu bar, adding a few cascading menus to it.
            MenuBar menu = new MenuBar();
            menu.addStyleName("demo-MenuBar");
            menu.addItem("foo", fooMenu);
            menu.addItem("bar", barMenu);
            menu.addItem("baz", bazMenu);

            // Add it to the root panel.  *********** This works ************
            //RootPanel.get().add(menu);

/* ==========

                DockLayoutPanel p = new DockLayoutPanel(Unit.EM);
                p.addNorth(new HTML("header"), 6);
                p.addSouth(new HTML("footer"), 2);
                p.addEast(new HTML("Ads"), 10);
                //p.add(new HTML("content"));

                p.add(menu);
============*/

            RootLayoutPanel rp = RootLayoutPanel.get();
            //rp.add(p);
           rp.add(menu);
        }
============================ ======

-- 
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