Name: rectangle

Synonyms: rect

Type: property

Syntax: set the rectangle of <object> to <left>, <top>, <right>, <bottom>

Syntax: get the [effective] rectangle of <object>

Summary:
Specifies the area within which an <object(glossary)> is drawn.

Associations: stack, card, field, button, graphic, scrollbar, player,
image

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
set the rectangle of button "Tangle" to 20,20,45,200

Example:
set the rectangle of group 1 to the rectangle of this card

Value:
The <rectangle> of an <object(glossary)> consists of four
<integer|integers> separated by commas.

Description:
Use the <rectangle> <property> to find out how far an
<object(glossary)> extends, to move it, or to resize it.

The four items of an object's <rectangle> describe the
<object|object's> left, top, right, and bottom edges:

* The <left> is the number of <pixels> between the left edge of the 
<stack window> and the leftmost pixel of the <object(glossary)>.
* The <top> is the number of <pixels> between the top edge of the 
<stack window> and the topmost pixel of the <object(glossary)>.
* The <right> is the horizontal distance in <pixels> between the left 
edge of the <stack window> and the rightmost pixel of the 
<object(glossary)>.
* The <bottom> is the vertical distance in <pixels> between the top
edge of the <stack window> and the bottommost pixel of the 
<object(glossary)>.

>*Note:* The sides of an <object|object's> <rectangle> specify the
> lines 
> between <pixels>, not the <pixels> themselves. For example, if an 
> <object|object's> <rectangle> is "0,0,2,2", the <object(glossary)> 
> includes four <pixels>, starting at the top left corner of the
> <card>. 
> In the case of a line or curve <graphic(keyword)>, the 
> <graphic(object)|graphic's> <rectangle> encloses all the <pixels> in 
> the <graphic(object)|graphic's> <points> <property> without touching 
> any of them.

If the object is a stack, its <rectangle> is relative to the left and 
top of the screen, rather than the left and top of the <stack window>.

The first two items of a card's <rectangle> are always zero. The third 
<item> is the <height> of the <card>, and the fourth is the <width> of 
the <card>.

>*Note:* The <rectangle> of a <graphic(keyword)> is drawn around all
> its 
> <points> without touching them. (Usually, this makes no difference, 
> but in some circumstances where you need to place a 
> <graphic(object)|graphic's> <vertex> precisely with respect to
> another 
> <object|object's> <rectangle>, you may need to take this into 
> account.)

If you specify the effective <keyword>, the rectangle includes the 
outline added by the <showFocusBorder> <property>. It also includes the 
heavy outline added to the <defaultButton>. If the <showFocusBorder> of 
the <object(glossary)> is false, or the <object(glossary)> is not 
currently <focus|focused>, the effective rectangle is the same as the 
rectangle.

>*Note:*As of version 6.0 the effective rect property of stacks returns 
> the rect of the given stack with its decorations and frame taken into 
> account. The effective rect of a stack can also be set. Here, the
> rect of the frame of the stack will be set appropriately before setting
> the rect of the stack.

Changes:
The use of the effective keyword with the rectangle property was 
introduced in version 1.1. In previous versions, the rectangle of the 
defaultButton included the heavy outline.

References: revChangeWindowSize (command), export snapshot (command),
crop (command), object (glossary), property (glossary),
keyword (glossary), focus (glossary), vertex (glossary),
stack window (glossary), integer (glossary), card (keyword),
item (keyword), graphic (keyword), moveStack (message), graphic (object),
bottom (property), topRight (property), pixels (property),
points (property), defaultButton (property), width (property),
showFocusBorder (property), height (property), backSize (property),
orientation (property), margins (property), windowManagerPlace (property)

Tags: ui

