Announcement

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

    Icon doesn't show up on MenuButton

    I am using the MenuButton. On the Menu button, you can set the title and icon. However, icon is not appearing on the Menu button that shows up. I have the following code:
    Code:
                    MenuButton newMenuButton = new MenuButton();
    		newMenuButton.setIcon("debugt_obj.gif");
    		newMenuButton.setWidth(80);
                    newMenuButton.setTitle("New");
                    // Set Menu
                    //newMenuButton.setMenu();
    Clearly, I must be missing something basic. If anyone has a sample to use MenuButton, that would be great. Thanks in advance.

    #2
    Place debugt_obj.gif under the "images" directory. By default images are resolved relative to public/images/

    Comment


      #3
      Thanks, Sanjiv. My images are under /public/images directory. Infact in other components, images are correctly rendered. However, MenuButton is always rendered without icon even when icon is set. I have the following simple onMenuLoad method that has MenuButton.

      Code:
         public void onModuleLoad() {
      	  MenuButton menuButton = new MenuButton("New");
      	  menuButton.setIcon("Dashboard-16x16.png");
      	  RootPanel rootPanel = RootPanel.get();
      	  rootPanel.add(menuButton);
        }

      Comment


        #4
        I have the same problem !

        Yes, i have the same problem...

        MenuButton.setIcon("URL");

        Is not working...

        Comment


          #5
          Seems to be a similar issue as with setting icons on tabs when the setClose = true, described here:

          http://forums.smartclient.com/showthread.php?t=6395&highlight=tab+icon

          However, I found the same work-around can be used for IMenuButton; i.e. create a menuButton like this:

          Code:
          IMenuButton menuButton = new IMenuButton("<span>"+ Canvas.imgHTML("/path/to/my/img.png") + "My Menu Title"+ "</span>");

          Comment

          Working...
          X