Set the icon to (icon of another stack)--YES!

Rob Cozens rcozens at pon.net
Thu Jan 5 00:40:47 EST 2006


All,

 >Chameleon stack script:

On the vain presumption this might actually be of use to some people, 
here's an improved version.  Initialization is moved from openStack 
to preOpenStack and the handlers otherwise tweaked.

local imagePath1,imagePath2,currentLibrary

on preOpenStack
   get the effective fileName of this stack
   set the itemDelimiter to "/"
   put "X2.rev" into item -1 of it
   put it into imagePath1
   put "X3.rev" into item -1 of it
   put it into imagePath2
   start using stack imagePath1
   put imagePath1 into currentLibrary
   refreshButtons
end preOpenStack

on switchLibraries
   set the itemDelimiter to "/"
   stop using stack currentLibrary
   close stack currentLibrary
   get item -1 of currentLibrary
   if it is "x3.rev" then -- use switch logic if toggling between 
three or more icon libraries
     start using stack imagePath1
     put imagePath1 into currentLibrary
    else
     start using stack imagePath2
     put imagePath2 into currentLibrary
   end if
   send "refreshButtons" to this stack in 1 tick
end switchLibraries

on refreshButtons
   lock screen
   repeat with x = 1 to the number of buttons
     set the icon of button x to (the icon of button x)
   end repeat
   unlock screen
end refreshButtons

Rob Cozens, CCW
Serendipity Software Company

Vive R Revolution!




More information about the use-livecode mailing list