Resize Images in Group

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
danrg7
Posts: 10
Joined: Fri May 25, 2007 7:42 pm

Resize Images in Group

Post by danrg7 » Thu May 01, 2008 10:49 pm

How can I resize images in a group when the group is resized? I want the images to stay in the proper positions relative to each other and to the new group rectangle. Is there any way I can do this?
Dan

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Fri May 02, 2008 11:40 am

There's various ways to do that. It mostly depends on how you actually change the size of the group. one way would be to send a "YouAreNowResized" message to the group, in every handler who resized it. Another approach would be to not resize the group directly, but to send it a "resizeNow" message, with the new rectangle it should take, then in that handler do all the resizing and moving.

Theoretically you could set a custom property of the group, and use the setprop style of command structure to do your thing. I have never used this approach, so i'm not sure what particularities this entails.

After you have decided on how to notify your group of a resize, you have to set the loc and rect of the objects within it. This is not much different from how to set them at the stack/card level. The most important difference is that all the positional and size properties will have to change relative to the group, and not the origin (0,0).


useful docu topics:
send command
setprop control structure
rectangle property
topleft property (and all it's siblings)
width property
height property
location property
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply