What was that thing with Photoshop images?

Peter M. Brigham pmbrig at gmail.com
Fri Aug 10 08:35:10 CDT 2012

On Aug 10, 2012, at 12:39 AM, Peter Haworth wrote:

> …Jacque - I know about the button you mentioned but ti still results in an
> image ID.  Here's the situation that caused me to ask the question.  I had
> around 30 images I was using as button icons, some for the enabled state,
> some for the disabled state.  I found a much better looking set of images
> to use, imported them with new IDs.  Now I had to go through all my buttons
> and change their IDs to the new ones.  Not a huge deal but if I had been
> able to set the button icons to image names, I would have had to do nothing.
> Plus Revolution makes a big deal about how English like and understandable
> the language is, and rightly so.  Image IDs like 1004 tell you nothing
> about where the image is in the stack while 'img "OpenStack" of Stack
> "myImages" tells you exactly where to find it.
> I don;t expect anything to change of course, just saying IMHO at least an
> option to use image names would be more understandable and maintainable.

It would be easy to write a handler that dose what you want. Something like this (untested):

on assignBtnImage tName, tBtnLongID
   put the long id of the target into stackName
   set the itemdelimiter to "/"
   delete item 1 to -2 of stackName
   delete word 1 of stackName
   replace quote with empty in stackName
   repeat with n = 1 to the number of images of stack stackName
      if the short name of image n of stack stackName = tName then
         set the icon of tBtnLongID to the short id of image n of stack stackName
      end if	
   end repeat
end assignBtnImage

Assuming images are all in the current stack -- and no duplicate image names, of course.

I may have an error or two in this, but you see the basic idea….

-- Peter

Peter M. Brigham
pmbrig at gmail.com

More information about the use-livecode mailing list