Announcement

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

    Change icon of a ToolStripButton

    I can't change the ToolStripButton's icon, after adding ToolStripButton to ToolStrip.

    My code:

    ToolStrip toolStrip = new ToolStrip();
    ToolStripButton printButton = new ToolStripButton("Print");
    printButton.setIcon("print.png");
    toolStrip.addButton(printButton);
    printButton.setIcon("print.png");

    The second setIcon call throws a Warning and doesn't set any icon:
    01:14:10.638:WARN:Label:isc_ToolStripButton_0_label:setImage: image 'undefined' couldn't be found

    How can I change icon?

    #2
    I have the same problem. Did you find any solution?

    Comment


      #3
      My workaround is to replace button each time i want to change the icon

      Comment


        #4
        "Always include the SmartGWT or SmartClient version and the browser(s) tested." This is clearly stated when you are posting to this forum.

        I tried your sample against the latest build and it works fine.

        Code:
        public void onModuleLoad() {
        
            ToolStrip toolStrip = new ToolStrip();
            toolStrip.setWidth(100);
            final ToolStripButton printButton = new ToolStripButton("Print");
            printButton.setIcon("cross.png");
            toolStrip.addButton(printButton);
            printButton.setIcon("ok.png");
        
            IButton button = new IButton("Change Icon", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    printButton.setIcon("cross.png");
                }
            });
        
            VLayout layout = new VLayout(10);
            layout.setMembers(toolStrip, button);
        
            layout.draw();
        }

        Comment

        Working...
        X