Button images script

Greg Wills gwills at ozemail.com.au
Mon Feb 17 06:38:01 EST 2003


Thanks Jim,

Your script will be of assistance in the laying out of the stack with 
many icon buttons. I have been playing round with having a very small 
dimensioned sub-stack with a picture on each card. I am only needing 
small pictures at this stage.

cheers

Greg



>Greg,
>
>One way to  set the button icons programmatically is to run  the
>"setUp" handler below. It presumes that each button which  is  to
>receive an image icon has been given the same name as the  image in
>the substack. It will run through all the cards in the main stack and
>if it finds a button whose name corresponds to an image in the
>substack, it will assign the image id to the button. (All images are
>located on the one card in the substack. It is relatively quick and
>painless.
>
>On setUp
>Lock screen
>    repeat with i =1 to the number of cards
>      set the defaultstack to "myStack"
>      go to card i
>      repeat with j = 1 to the number of buttons
>        put the short name of button j into tButtonName
>        set the defaultstack to "mySubstack"
>        if there is an image tButtonName then put the id of image
>tButtonName into tImageID
>        set the defaultstack to "images"
>        set the icon of button j to tImageID
>      end repeat
>    end repeat
>    unlock screen
>end setUp
>
>Jim Hurley
>



More information about the use-livecode mailing list