295 png import images

Jan Schenkel janschenkel at yahoo.com
Wed Oct 12 04:23:41 CDT 2011


Hi Phil,

The trick is to use an image, set the icon of the button to the id of said image, and then change the filename of the image; your button will automagically be repainted when you change the filename of the image control.

As a quick test, I created a stack with a button and an image; I named the image control "MyButtonIcon"; and then I set the script of the button to:
##
on mouseUp
   answer file "Select an image for my icon"
   if it is empty then exit mouseUp
   set the fileName of image "MyButtonIcon" to it
   if the icon of me is 0 then set the icon of me to "MyButtonIcon"
end mouseUp
##

When I click the button, I can go find an image file and the button gets it as a shiny new icon :-)


HTH,

Jan.

Jan Schenkel

=====
Quartam Reports & PDF Library for LiveCode
www.quartam.com


=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)




----- Original Message -----
From: Phil Davis <revdev at pdslabs.net>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Cc: 
Sent: Wednesday, October 12, 2011 8:06 AM
Subject: Re: 295 png import images

It didn't work here - 'filename' isn't a button property, and setting the icon 
to a url doesn't work either. However, you can make an image object act pretty 
much like a button, responding to mouse clicks and such.

Phil



More information about the use-livecode mailing list