Seting an object's geometry by script

Eric Chatonet eric.chatonet at sosmartsoftware.com
Wed Jun 8 17:08:39 EDT 2005


Hi Eric,

Just write a resizeStack handler and set the dimensions of the  
objects accordingly :-)
See the resizeStack message in the docs.
For instance:

on resizeStack pNewWidth,pNewHeight,pOldWidth,pOldHeight --  
parameters values are provided by the engine
   local tRect,tLoc
   -----
   set the right of img "TitleBarRight.png" to pNewHeight
   -----
   put the rect of img "TitleBarMain.png" into tRect
   put pNewHeight into item 3 of tRect
   set the rect of img "TitleBarMain.png" to tRect
   -----
   put the rect of img "AluBg.png" into tRect
   put pNewHeight into item 3 of tRect
   set the rect of img "AluBg.png" to tRect
   -----
   set the loc of grp "Tabs" to the width of this cd / 2,item 2 of  
the loc of grp "Tabs"
   -----
   put the rect of fld "input" into tRect
   put (pNewHeight - 2) into item 3 of tRect
   put (pNewWidth - 22) into item 4 of tRect
   set the rect of fld "input"  to tRect
   set the vScrollBar of fld "input" to the formattedHeight of fld  
"input" > the height of fld "input"
   if the dontWrap of fld "Input" then set the hScrollBar of fld  
"input" to the formattedWidth of fld "input" > the width of fld "input"
   -----
   put the loc of fld "Title" into tLoc
   put pNewHeight / 2 into item 1 of tLoc
   set the loc of fld "Title" to tLoc
   -----
   set the right of grp "Copy" to the right of grp "Tabs" + 1
   set the right of grp "Help" to pNewHeight - 10
   -----
   set the bottom of grp "Replace" to pNewWidth + 6
   -----
   put the rect of img "AluBgBottom.png" into tRect
   put pNewHeight into item 3 of tRect
   set the rect of img "AluBgBottom.png" to tRect
   set the bottom of img "AluBgBottom.png" to pNewWidth
   set the top of grc "Line" to pNewWidth - 1
   -----
   set the bottomRight of btn "Mac Style Stack Resizer" to pNewHeight  
- 3, pNewWidth - 3
end resizeStack

Note that you need not to lock the screen: the engine does it for  
you :-)

Le 8 juin 05 à 22:55, Éric Miclo a écrit :

> 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.

Best regards from Paris,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Plugins, tutorials and more on our website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------



More information about the use-livecode mailing list