Search code examples
gwtsmartgwt

Menu or MenuButton with separate click handler


I'm looking for a widget like this.

http://ppt.cc/RPfL

Clicking "View" and triangle (drop down icon) need to perform two different functions.

Clicking the triangle opening the menu.

I tried creating 2 buttons to emulate, but the 2 buttons have extra space in between them.

How can I eliminate the space between buttons or, is there a convenient way to accomplish this?

thank you all!!


Solution

  • An IconMenuButton (which is a sub class of IconButton) will provide what you need.

    Menu menu = new Menu();
    
    MenuItem newItem = new MenuItem("New");
    MenuItem openItem = new MenuItem("Open");
    MenuItem saveItem = new MenuItem("Save");
    MenuItem saveAsItem = new MenuItem("Save As");
    
    menu.setItems(newItem, openItem, saveItem, saveAsItem);
    
    IconMenuButton menuButton = new IconMenuButton("View", menu);
    

    Also check SmartGWT samples I've given in my comment and RibbonBar sample.