Shrinking an image to a button icon

Jim Carwardine JimCarwardine at OwnYourFuture-net.com
Fri Dec 26 08:39:57 EST 2003


Jacque, I'm still wrestling with the placement of the picture on the
palette.

This is the rect of the palette stack "picture" (186,413,486,626)

This is the rect I'm getting on the picture when I execute the script below
(-29,-20,328,233)... I'm not getting the whole picture in the card window.
I've tried jockeying with the topLeft of the picture but, although it moves
the picture around, the picture still gets cropped... Jim

BTW... Merry Christmas everyone...

  if it is "Enlarge" then
    lock screen
    go stack "Picture"
    put 300 into theTargetSize -- adjust size here
    set the filename of img "Palette Picture Graphic" to the pictPath of me
    put theTargetSize/the formattedwidth of img "Palette Picture Graphic"
into theRatio
    set the width of img "Palette Picture Graphic" to theTargetSize
    set the height of img "Palette Picture Graphic" to \
        round(the formattedheight of img "Palette Picture Graphic" *
theRatio)
    set the width of this stack to the width of img "Palette Picture
Graphic"
    set the height of this stack to the height of img "Palette Picture
Graphic"
    set the topleft of stack "Picture" to 380,310
    set the topleft of img "Palette Picture Graphic" to 0,0
    palette stack "Picture"
  end if


on 12/23/03 9:27 PM, J. Landman Gay wrote:

> On 12/23/03 6:16 PM, Jim Carwardine wrote:
> 
>> Thanks, again, Jacque.  One more niggling little thing I can't figure out...
>> When I shut down Rev and reopen it, the button icon I created reverts back
>> to it's original size, but cropped to the size of the button.  I'm sure it's
>> because I'm storing the reference to the original pict, but what do I store
>> to indicate the new size?
> 
> An image will revert to its natural size whenever the card is next
> opened, unless the image is locked in place. Set the image's
> lockLocation property to true and save the stack. You only have to do
> this once during development. Images with their lockLoc set to true can
> still be sized via script but do not automatically resize on opencard,
> and can't be resized with the mouse.
> 
> Use the property inspector (under the Size and Position tab) to set
> this. If you don't have transcript terminology turned on, the checkbox
> is called "lock size and position".
> 
> The button icon is always the same size as the original image, so when
> the original reverts, the icon on the button does too.

-- 

OYF is... Highly resourceful people working together.
<http://www.OwnYourFuture-net.com>

Own Your Future Consulting Services Limited,
1959 Upper Water Street, Suite 407, Halifax, Nova Scotia. B3J 3N2
Info Line: 902-823-2477, Phone: 902-823-2339. Fax: 902-823-2139





More information about the use-livecode mailing list