Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Change MenuItem "-" separator and sub menu ">" icon

    Hi,

    On a MenuBar is it possible to change the default MenuItem "-" separator and the MenuItem sub menu ">" icon?

    Cheers
    Rob

    #2
    For the submenu, setAttribute("submenuImage", "imagetoreplacewith.gif") but needs to be 7x7 pixels. I don't think there is anything you can do to change the separator.

    Comment


      #3
      Hi,

      Thanks for the feedback.

      ...

      private static final String SUBMENU_ICON = "menu/submenu.png";

      ...

      // add the sub menu to the menu item
      menuItem = new MenuItem(subMenuName);
      // we want a 'blue' submenu '>' icon
      menuItem.setAttribute("icon", SUBMENU_ICON);
      parentMenu.addItem(menuItem);
      menuItem.setSubmenu(menu);

      return menu;
      }

      I tried "submenuImage" but it didn't work, "icon" works (see attached) which makes me think changing "submenuImage" isn't supported? Or, its the wrong attribute name.

      Overwriting the image "submenu.png" in the \sc\skins\EnterpriseBlue\images\Menu works of course.

      Any suggestions?

      Cheers
      Rob
      Attached Files
      Last edited by robferguson; 20 Jul 2010, 20:32.

      Comment


        #4
        Ok so using JSNI you can get it:
        [CODE]
        public class MyMenu extends Menu {
        public native void changeIconSubmenu() /*-{
        var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()();
        self.submenuImage = {src:"myimage.GIF", width:7, height:7};
        }-*/;
        };
        [CODE]

        However you need to call that immediately AFTER you call draw() on the menu.

        Comment

        Working...
        X