scale field with window

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hamlynart
Posts: 101
Joined: Wed Mar 19, 2008 7:10 pm
Contact:

scale field with window

Post by hamlynart » Tue Dec 08, 2009 10:04 pm

Hi folks,

I've not used Rev in a while now and I can't work out how to get a text field to dynamically scale (resize) with the window (stack). Any ideas?

Thanks a million

Jim H

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: scale field with window

Post by bn » Tue Dec 08, 2009 10:11 pm

Hello Jim,

make one field and two buttons in a new stack. In the properties inspector under size set the minWidth to 600 and the minHeight to 500. Put this script into the stack or card

Code: Select all

on resizeStack tnewWidth, tNewHeight
   if tNewWidt < 600 or tNewHeight < 500 then exit resizeStack
   lock screen
   set the width of field 1 to tNewWidth - 100
   set the height of field 1 to tNewHeight - 110
   set the topleft of field 1 to 50,40
   put the bottom of field 1 into tFieldBottom
   set the top of button 1 to tFieldBottom +20
   set the top of button 2 to tFieldBottom +20
   set the right of button 2 to the right of field 1
   set the left of button 1 to the left of field 1 + 20
   set the scroll of field 1 to 100000 -- in case it is a scrolling field and you want to scroll it all the way down
   unlock screen
end resizeStack
the two buttons are at the bottom of the field and stay there.
Change/add what is needed.
regards
Bernd

hamlynart
Posts: 101
Joined: Wed Mar 19, 2008 7:10 pm
Contact:

Re: scale field with window

Post by hamlynart » Tue Dec 08, 2009 10:31 pm

Hi Bernd,

Blimey - absolutely perfect!

Thanks a million.

Jim H

Post Reply