Page 1 of 1

Expanding borders of Groups

Posted: Sat May 14, 2016 9:13 pm
by richmond62
If I make a group of 2 objects, where the largest is 120 x 120 pixels the group measures 128 x 128 pixels:
group1.png
This is not always what one wants.

I often want my group to be the same size as the biggest object within it.
HOWEVER, if I resize my group to 120 x 120 pixels the component objects end up being displaced:
group2.png
The way to avoid this is fiddly, but effective: one has to centre each component object using the
Properties Palette:
group3.png

Re: Expanding borders of Groups

Posted: Sat May 14, 2016 9:29 pm
by richmond62
To speed things up, having grouped ones objects, one can then unGroup them
again and position them all together, and then reGroup them.
group4.png

Re: Expanding borders of Groups

Posted: Sun May 15, 2016 3:31 pm
by jiml
Richmond,

Just set the margins of the group to 0 (zero).

It will contract to the size of the largest object within.

Jim Lambert

Re: Expanding borders of Groups

Posted: Sun May 15, 2016 3:40 pm
by jiml
Rather it will contract to the extents of the objects within the group.

When you group objects LC adds a 4 pixel margin.
So if you have a 120x120 object and then group it, the group will be 128x128 - as your example shows.
Simply set the group's margin to 0, and you will end up with a group that is 120x120.

Jim Lambert

Re: Expanding borders of Groups

Posted: Sun May 15, 2016 3:42 pm
by jacque
Besides margins, turn off lockLoc. It's preventing the group from automatically snapping to the size of the components.

You can turn it on again after it resizes if you want.

Re: Expanding borders of Groups

Posted: Sun May 15, 2016 5:52 pm
by richmond62
Thanks jacque and jimi both!

However, the dictionary says this:
By default, the lockLocation property of a newly created control is set to false.
So I wonder why one needs to turn it OFF for a group.

Re: Expanding borders of Groups

Posted: Sun May 15, 2016 6:45 pm
by jacque
It's off by default unless something has changed the templateGroup, but in your images it's been turned on.

Re: Expanding borders of Groups

Posted: Sun May 15, 2016 6:57 pm
by richmond62
Well, I locked my images, but I DIDN"T lock my Group when
I grouped the images.

Maybe, had I not locked the images initially . . . .

Re: Expanding borders of Groups

Posted: Sun May 15, 2016 7:11 pm
by jacque
I just tested in LC 8 and grouping does not set the lockLoc of the group to true. You may have had selectGroupedControls turned off when you locked what you thought was an image, and accidentally locked the group instead.

Re: Expanding borders of Groups

Posted: Sun May 15, 2016 7:18 pm
by richmond62
I just tested in LC 8
I did that in 7.1.4.