Geometry manager

Richard Gaskin ambassador at fourthworld.com
Fri Jan 29 14:34:04 EST 2010


Ben Rubinstein wrote:

> On 20/1/10 19:51, Richard Gaskin wrote:
>> PS: a real time-saver for me in writing resizeStack handlers has been
>> this SetRect command:
>
> My slightly different approach is a couple of ugly commands adjustObjectPosn
> and adjustObjectRect (below), which allow the layout of a bunch of controls to
> be described like this:
>
> on resizeCard
>    adjustObjectRect "grc", "TabBacker",  "this card", "",     "-,-,R+1,-"
>    adjustObjectRect "fld", "Report",     "this card", "",     "-,-,R-20,B-40"
>    adjustObjectRect "fld", "FTPlog",     "this card", "",     "-,-,R-20,B-40"
>    adjustObjectPosn "grp", "FTPlogCons", "fld", "Report",     "L,B+6,-,-"
>    adjustObjectPosn "btn", "ToggleWrap", "fld", "Report",     "-,B+6,R,-"
>    adjustObjectRect "fld", "FTPprogFld", "btn", "ToggleWrap", "-,-,L-2,-"
> end resizeCard
>
> That is, the commands let you set the position or rectangle of one control,
> relative to another control or the card, by specifying new values for any/all
> of the four edges those specifications in the form of expressions which
> can include the loc (X, Y), dimensions (W, H), or rect (L,T,R,B) of the
> reference control.

Nicely done, Ben.  Very useful for a great many circumstances.

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