Seting an object's geometry by script

Richard Gaskin ambassador at fourthworld.com
Wed Jun 8 18:34:56 EDT 2005


Éric Miclo wrote:
 >>> Does someone know if there is a way to set an object's geometry  by
 >>> script and where I can find some documentation to write the
 >>> corresponding scripts.
 >>
 >> The Geometry Manager is triggered by the engine's resizeStack
 >> message. You can use that message directly like this:
 >>
 >>  on resizeStack x,y
 >>     set the rect of fld 1 to 20,12,x-20,y-20
 >>  end resizeStack
 >>
 >> In the card or stack script of a stack containing a field, that
 >> script will resize the field's rectangle so its topleft is at  20,12,
 >> and the right is 20 pixels in from the right edge of the  stack and
 >> the bottom is 20 pixels up from the bottom of the stack.
 >
 > What I wanted to do is to set the geometry of an object by script and
 > not writing a script that resizes objects when the stack is resized.
 > Am I clear.
 > What I wanted to know is if an object's geometry is a sort of
 > property that can be set.

Yes, most everything related to objects in Transcript comes down to 
getting and setting properties.

One of the most valuable ways to learn Transcript is through dissection, 
reading other people's scripts, looking up in the Transcript Dictionary 
any keywords you don't recognize, and then playing around with what you 
learn there.

The "set" command sets the value of a property, and if you look at the 
one line in the handler the property is sets is "rect".

Look up "rect" (the longer form "rectangle" is an accepted synonym) in 
the Transcript Dictionary, and after reading that entry follow the "See 
Also" links to other entries that seem of interest to you.

With a few minutes in the dictionary you will have mastered setting the 
rectangle of objects, ready for the next thing to learn....

--
  Richard Gaskin
  Fourth World Media Corporation
  __________________________________________________
  Rev tools and more: http://www.fourthworld.com/rev


More information about the use-livecode mailing list