Add a seperate command to each menu item.
Example:
  ueberBint.addItem("Unternehmen", true, new Command() {
    public void execute() {
      Window.alert("User selected this one");
    }
  });
  ueberBint.addItem("Partner", true, new Command() {
    public void execute() {
      Window.alert("User selected that one");
    }
  });


On Apr 14, 3:42 pm, Chuck <[email protected]> wrote:
> Hi there!
>
> I just tried to create a menu bar of GWT and I'm getting a little bit
> frustrated. I tried to find a solution on the internet but
> unfortunately it seems to be too simple for everyone. I'd like to
> create a menu which is working. But I have no idea how to work with
> the events. The following command in the code is working fine but how
> can I check which item executed the command?
> I tried to use the method onBrowserEvent() but honestly I have no idea
> how to use it.
>
> Here's my method:
>
> public void setNewNavi() {
>
>           Command cmd = new Command() {
>                   public void execute() {
>                           Window.alert("test");
>                   }
>           };
>
>           MenuBar start = new MenuBar(true);
>           start.addItem("Startseite", cmd);
>
>           MenuBar ueberBint = new MenuBar(true);
>           ueberBint.addItem("Unternehmen", true, cmd);
>           ueberBint.addItem("Partner", true, cmd);
>           ueberBint.addItem("Referenzen", true, cmd);
>           ueberBint.addItem("Publikationen", true, cmd);
>
>           MenuBar news = new MenuBar(true);
>
>           MenuBar hauptNavi = new MenuBar();
>           hauptNavi.addItem("Start", true, start);
>           hauptNavi.addItem("&Uuml;ber Bint", true, ueberBint);
>           hauptNavi.addItem("News", true, news);
>
>           // Add it to the root panel.
>           RootPanel.get("navigation").add(hauptNavi);
>   }
>
> Can anybody help?
--~--~---------~--~----~------------~-------~--~----~
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