Seting an object's geometry by script

Éric Miclo eric.miclo at wanadoo.fr
Wed Jun 8 19:30:18 EDT 2005


Hello again,

Well setting rect, loc, ... for objects is not quite a problem.
I wanted to be able to set an object's geometry property inside a  
script because I've a stack where the user can create a new card with  
a button that's not part of a group behaving as a background.
The button is different on each card (each time with another script).  
So at the moment the new card and the new button are created I wanted  
to set the button's geometry withing the script where all other  
properties for that button are set (size, location, ...).

I'm also not able to look at the contents of the cRevGeometry  
property for an object as suggested by Éric Chatonet (salut Éric) and  
I'm not sure it is a good idea to try to make changes to that  
property without knowing how it is built.

For the moment I just set the loc of my button with a resizeStack  
handler (it's working).

Thanks for all,

ÉrIC

Le 9 juin 05 à 00:34, Richard Gaskin a écrit :

> É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
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>

-- My NeXT computer will Be a Mac too! --




More information about the use-livecode mailing list