Geometry manager

Richard Gaskin ambassador at fourthworld.com
Wed Jan 20 14:51:54 EST 2010


Mark Wieder wrote:

>> Do not use the geometry manager in commercial projects. It'll cost you
>> money in the end. Write your own scripts.
>
> Word.

Word ++.

Even if it saves a little time today (and after all those clicks how 
much time would that be?), if it ever goes south you'll need to not only 
write your own handlers, but also make sure Rev's libraries don't ever 
bother with those objects again.

I've written some complex layouts and the worst case I've ever had 
required less less than half the number of lines of codes as their are 
objects.  A small price to pay for the best possible performance and the 
most robust, flexible, and extensible implementation.

Duty now for the future....


PS: a real time-saver for me in writing resizeStack handlers has been 
this SetRect command:


on resizeStack x,y
   -- Extend the Title field relative to the left of the card, and
   -- set the bottom to include any space needed for its contents:
   SetRect the long id of fld "Title" "","", x-20,\
      the top of fld "Title" + the formattedHeight of fld "Title"
   --
   -- Position the Body field below the Title field, and set its
   -- width and height relative to the edges of the card:
   SetRect the long id of fld "Body", "", \
      the bottom of fld "Title" + 12, x-20,y-20
end resizeStack


on SetRect pObj
    put the rect of pObj into tRect
    repeat with i = 1 to 4
      get param(i+1)
      if it is not empty then
         put it into item i of tRect
      end if
    end repeat
    set the rect of pObj to tRect
end SetRect


With this handler I can have objects adjusted relative to the card or 
other objects, and I never need to write more than one line.

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list