How do I import/read images and their ID from a separate folder to change the icon of a button?

J. Landman Gay jacque at hyperactivesw.com
Sun Nov 27 13:59:48 EST 2011


On 11/27/11 8:38 AM, William de Smet wrote:

> Eventually I will need a lot of images and now I was thinking of
> keeping the images outside of the stack in a separate folder.
> Is it possible to do the same thing? Read the images and their ID and
> set the icon of the button to the ID of an image.

Images stored as files on disk don't have an ID, so you can't use them 
as button icons. But instead of an icon you could just show the image 
itself. You can use a single image object and replace its contents every 
time you want to change it. This will do it:

   put url ("binfile:"&tImgPath) into image 1

Or the alternate syntax:

   set the text of image 1 to url ("binfile:"&tImagePath)

If you will have a lot of images then storing them on disk is the best 
way to manage them.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list