> Re: ReSize Button Icon

kevin said :

You can't resize an image used in a button icon.

Katirswami: true, you can't resize the image by "hacking" the button, but:

 I have to say that I am embarrassed to have turned around and solved my own
problem, which I should have done before posting the question. . .but maybe
this is useful since everyone thinks it can't be done.

You CAN dynamically resize images 'behind the scenes,' and then reassign
them as icons to the button in question:

on mouseUp
  global tOriginalSize, tSyllable
   set the defaultstack to "Alphabet"
      #this stack contains the images but they are not displayed or used
  ask "What Percentage?"
         # later we will have trap here for correct input
          #. .   .must be a value between .25 and 4 max to
          # still   fit in the window.
  put it into tScale
  Ask "which image?"
    # this is a number from 1 to the number of letters in the alphabet
    # where the letters are ordered by their layer. . .
    # we should probably use names and load them into an associative array
    # for easy access which we will do later
  put it into tSyllable
  put the rect of image it into tOriginalSize
  set the width of image it to (tScale* the width of image it)
  set the height of image it to (tScale* the height of image it)
           # the image has now been resize behind the scenes
  set the defaultstack to "shum basics"
  set the icon of button "theImage" to 2000+it
       # where the id of the image that was  just resized is 2000+it
end mouseUp

on restoreSize
   global tOriginalSize, tSyllable
   set the rect of image tSyllable to tOriginalSize
   set the icon of button "theImage" to 2000+tSyllable
end restoreSize

This works great! and means we can load a single alphabet as large (300
point) GIFs (large is better because down sizing maintains sharpness,
upsizing small image causes them to "break down" pixelate. . .) and
dynamically create "font sizes" (i'll use percentages like 1/2 size, quarter
size, double size) of that alphabet via script using buttons as containers
for the syllables. And, additionally, resizing the image by script forces a
screen redraw of the button without  waiting for any other event. We would
have to store their original sizes in some off line location: probably as a
user prop of themselves would make the most sense.

It means we can take our most beautiful Sanskrit fonts in Quark Express,
dump all the letters as GIFS and voila we have an alphabet which is cross
platform hardware-keyboard context independent. Anyone see any caveats to
this? 

Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
www.HinduismToday.com
[EMAIL PROTECTED]



Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to