Resizing stack to any screen size!

D.Rothe drothe at optusnet.com.au
Sat Jan 1 17:54:52 EST 2005


Hi all,
Have seen a few posts about how to rezize a stack to suit your screen size, here's how I did it!

Resizing the main stack to suit any screen size is quite simple really, the challenge comes when trying to keep all your fields in a relative size & position. 
To resize a stack to any screen size I use the following code;

on preOpenStack
-- get users screen size -- left,top,width,height

   put the screenrect into tScreenSize

-- *Note: screenrect is the working size of the window NOT including borders.
-- For this reason we set the parameters as follows.

   set itemDel to ","
   put item 3 of tScreenSize into tWidth
   put item 4 of tScreenSize into tHeight
   set the rect of this stack to 2,28,tWidth-2,tHeight-4

end preOpenStack

2 puts the window 2 pixels from the left
28 puts the window 28 pixels from the top, this allows the window title bar to show.
tWidth-2 sets the overall window width to the screen size -2 pixels to allow the border to fit.
tHeight-4 sets the overall window height to the screen size -4 pixels to allow the border to fit.

This setting works well using windows XP but I haven't tested it on other OS'.

To manipulate fields etc. use; set the rect of fld "fieldname" to ?,?,tWidth-?,tHeight-?

Happy New Year!! ..... Dwayne


More information about the Use-livecode mailing list