The rectanglealign( function aligns a small rectangle at one of nine positions within a larger rectangle.


This function has three parameters:

largerect – the larger rectangle.

smallrect – the smaller rectangle.

alignoptions – alignment position of the resulting smaller rectangle relative to the larger rectangle, may contain the keywords center, top, left, bottom, and right. If multiple keywords are used, they must be separated by spaces, for example "bottom center".


This function aligns a small rectangle inside of a larger rectangle. The small rectangle can be aligned in one of nine positions: top left, top center, top right, left center, center, right center, bottom left, bottom center, and bottom right. If an alignment axis is not specified it is assumed to be center, for example top is the same as top center. The order of the options does not matter, for example top left and left top are the same.

This example assumes that the current form has two objects named Frame and Photo. The code moves the Photo object to the bottom right corner of the Frame object.

local newSpot
newSpot = rectanglealign(objectinfo("rectangle","Frame"),objectinfo("rectangle","Photo"),"bottom right")
changeobject "Photo","rectangle",newSpot

See Also


10.0No ChangeCarried over from Panorama 6.0