1 Reply Latest reply on Jun 7, 2012 8:24 AM by philmodjunk

    Changing button appearance when selected



      Changing button appearance when selected



      I have a button which I would like to use as a switch (on/off).  When "on" it should show a "red" image, when "off" show "grey" image (really a check sign from Istock).  When the switch is off, and selected, I have a script to set a field to "Y", and to "" if the field is already "Y" effectively turning it off. 


      How do I get the image to change from "grey" to "red"?


      So far I created the button using the inspector and chose the grapic "image".

       Thanks Ken

        • 1. Re: Changing button appearance when selected

          If this were text instead of a graphic, you could use conditional formatting to change the color of the text. You might consider looking for a symbol character that will work instead of a graphic if what you have is a simple check or "tick" mark.

          Since this is a graphic image, you need two copies of your graphic, one in each color.

          You can then load these images in container fields and define a calculation field that specifies container as its return type. The calculation returns the contenst of one of your two container fields to display the image in the specified color.

          How you store the images depends a bit on your system. If this is a single user file, you can put the images in global container fields. If it is hosted over the network, you may want to define a table where you have either one record with two container fields or two records with a single container field each to store your two images. You can then use a script that runs when the file opens to copy the images into global fields.

          Once you have your global container fields loaded with your two images, Your calculation might be written like this:

          If ( YourField = "Y" ; GlobalContainerField1 ; GlobalContainerField2 )