Announcement

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

    Image for selected Icons

    Hi all,

    I am trying to implement some window pin down functionality similar to the one described here:
    http://forums.smartclient.com/showthread.php?t=10209&highlight=HeaderControl
    The icon toggle (on/off) there is implemented via handlers. Since I can set setShowSelectedIcon(), e.g.
    Code:
    final HeaderControl pinDown = new HeaderControl(HeaderControl.PIN_DOWN);
    pinDown.setActionType(SelectionType.CHECKBOX);
    pinDown.setShowSelectedIcon(true);
    and the docs says
    setShowSelectedIcon:
    If using an icon for this button, whether to switch the icon image when the button becomes selected.
    I wonder where I can actually set the icon image for the selected icon. Any ideas or good practices?

    Thanks
    fatzopilot

    #2
    For the "Selected" state, you need to have media like pin_Selected.png that corresponds to this state. The default skins do not have such separate Selected states for the headerIcons (see [SKIN]/images/headerIcons). So best if you create your own media in a folder that has images corresponding to the states you want and then create a new HeaderControl instance passing a HeaderIcon instance which points to your media directory. Have a look at the source of the HeaderControl class.

    Sanjiv

    Comment


      #3
      Works fine now, thank you.
      What other icon name suffixes are supported?
      E.g. pin_Selected_Over.png can be used for defining the down and hover effect. Is there documentation on this?

      Thanks
      fatzopilot

      Comment


        #4
        img[_Selected][_Focused][_Down | _Disabled | _Over].png

        Comment


          #5
          Using SmartGWT 4.0-2013-11-30, will upgrade if necessary.

          How can I set the "disabled"/whatever version if an image?

          For example, I am testing with an IButton, and I call setIcon () to the the url of the image to display. I would like something like "setDisabledIcon ()" to set the disabled version of that image.

          The "_Disabled.png" default logic bit does not work for me because I am working on a project where the images are generated on the client, which I can pass into IButton.setIcon () as base-64 images, but then I need a way to also specify the "disabled" version of the icon...

          Comment


            #6
            Upgraded to 5.0-2015-01-11 and I don't see a way to set these...

            I am looking for the same: how do I set the following images client-side?
            img[_Selected][_Focused][_Down | _Disabled | _Over].png

            Maybe a callback, say something like this?
            Code:
            String getImageSrc (String image, String suffix);
            This way I could return my cached images as base64, or call some default SmartGWT implementation that returns the default url?

            Or maybe a callback like this:
            Code:
            String getImageSrc (String src);
            That simply lets me "override" the default url with my base64?

            Comment

            Working...
            X