Announcement

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

    changing button icon on click

    Hi,

    How can I change a button icon in onclick event?
    button.setIcon() doesnt work (in smartGWT, build 1.0b1).

    That's what I'm trying to do:
    Code:
    Button iconOnly= new Button();
    iconOnly.setIcon("icon1.png"); 
    
    Button otherButton = new Button();
    otherButton.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    iconOnly.setIcon("icon2.png"); //this line has no influence in UI
                }
            });
    thanks!

    #2
    You should see an IllegalStateException raised indicating that this property cannot be changed after the component has been rendered.

    See the javadoc Button.setIcon

    Code:
    java.lang.IllegalStateException - this property cannot be changed after the component has been created
    So changing of this property post-render is currently not supported. Perhaps the SmartClient folks can make this enhancement. Feel free to create an issue in tracker.

    Sanjiv
    Last edited by sjivan; 11 Jan 2009, 20:46.

    Comment


      #3
      FYI Button.icon and IButton.icon will become a runtime-settable attribute as of 7.0 final.

      Thanks
      Isomorphic Software

      Comment


        #4
        This is now supported in SVN.

        Comment

        Working...
        X