Thank you Magnus,
With your suggestion I have solved my menubar display problem as
follow:
==========================================
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!");
}
};
MenuBar fooMenu = new MenuBar(true);
fooMenu.addItem("the", cmd);
fooMenu.addItem("foo", cmd);
fooMenu.addItem("menu", cmd);
MenuBar barMenu = new MenuBar(true);
barMenu.addItem("the", cmd);
barMenu.addItem("bar", cmd);
barMenu.addItem("menu", cmd);
MenuBar bazMenu = new MenuBar(true);
bazMenu.addItem("the", 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.addItem("foo", fooMenu);
menu.addItem("bar", barMenu);
menu.addItem("baz", bazMenu);
DockLayoutPanel p = new DockLayoutPanel(Unit.EM);
p.addNorth(new HTML("header"), 6);
p.addSouth(new HTML("footer"), 2);
p.addEast(new HTML("East"), 10);
p.addNorth(menu, 2);
p.add(new
HTML("content=================================================================="));
RootLayoutPanel rp = RootLayoutPanel.get();
rp.add(p);
}
=============================================================
On Jul 13, 9:27 pm, jim9 <[email protected]> wrote:
> Hello GWTer:
>
> I am new to GWT, so please help.
>
> I can not get cascademenuBarand 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.
> MenuBarfooMenu = newMenuBar(true);
> fooMenu.addItem("thefoo", cmd);
> fooMenu.addItem("foo", cmd);
> fooMenu.addItem("menu", cmd);
>
> MenuBarbarMenu = newMenuBar(true);
> barMenu.addItem("thebar", cmd);
> barMenu.addItem("bar", cmd);
> barMenu.addItem("menu", cmd);
>
> MenuBarbazMenu = newMenuBar(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.
> MenuBarmenu = newMenuBar();
> 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.