Geometry Issue

Richard Gaskin ambassador at fourthworld.com
Mon Oct 20 13:04:06 EDT 2003


Thomas J McGrath III wrote:

> I am trying to get the Geometry pane to be agreeable. I have two fields
> beside each other at the bottom of the window. I want the one on the
> left to stay the same width but grow down and the one on the right to
> stay the same height  but grow left and right to keep up with the width
> between the left field and the right window border.
> 
> What I have happening is that the left field acts as expected but the
> top of the right field stays where it is and grows left and right but
> also up and down. I can't get it to stop up and down growing.

A generalized solution like the Geometry Manager is a useful time-saver, but
as with any generalized solution there are times when rolling your own is a
good option.

One difficulty with a generalized solution is determining the order in which
objects are resized.  If you have objects whose rect is dependent on the
rect of other objects this order of execution can be critical.

Fortunately a resizeStack handler is usually easy enough to write, though it
can get tedious if you have a lot of objects.  But with two fields it's a
snap.

The resizeStack message is accompanied by two arguments which describe the
new width and height of the stack.  Here these are used to place two fields,
with a 20-pixel gap between the edge of the field and the windows and a
12-pixel gap between the twp fields (of course, alter as needed for whatever
gaps you want):

on resizeStack x,y
   -- Left field resizes vertically:
   set the rect of fld 1 to 20, 20, 250, y-20
   -- Right field resizes horizontally:
   set the rect of fld 2 to \
        the right of fld 1+12, 20, x-20, the bottom of fld 2
   -- Pass the message in case anything downstream needs it:
   pass resizeStack
end resizestack


-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Developer of WebMerge: Publish any database on any Web site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc



More information about the Use-livecode mailing list