Name: margins

Type: property

Syntax: set the margins of <object> to {<pixels> | <left>, <top>, <right>, <bottom>}

Summary: Specifies how much empty space is left on each side between an <object|object's> edges and its contents.

Introduced: 1.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Example:
set the margins of group ID 8 to 20 -- sets all four margins

Example:
set the margins of button myButton to 2,10,2,10

Example:
set the margins of field "Info" to three

Value:
The <margins> of an object consists of either a <non-negative> <integer(keyword)>, or four <non-negative> <integer(glossary)|integers> separated by commas.
By default, the <margins> <property> of a <field(keyword)> is set to 8. If the <field(object)|field's> <wideMargins> <property> is true, the <field(object)|field's> <margins> is set to 20.

The default <margins> setting for an <object> other than a <field(keyword)> is 4.

Description:
Use the <margins> <property> to control how close text within a <button> or <field(keyword)> can come to the <object|object's> edges, how close <object|objects> in a <group(command)> can come to the <group(glossary)|group's> edges, and how the <label> of a <graphic> is displayed.

If a single integer is specified, all four margins of the object are set to that number of pixels. If four integers are provided, the object's top, left, bottom, and right margins are set to each one respectively:

* item 1 of the <margins> <property> is equal to the leftMargin
*  2 of the <margins> is equal to the topMargin
*  3 of the <margins> is equal to the rightMargin
*  4 is equal to the bottomMargin

If the lookAndFeel is set to "Motif", <control(object)|controls> require two <pixels> of margin space for the border that shows when the <control(keyword)> is <active (focused)(glossary)>. To avoid interfering with this border on <Unix|Unix systems>, set the <margins> <property> of <group(glossary)|groups> to at least 2 if the <group(command)> contains <control(object)|controls> whose <traversalOn> <property> is set to true.

>*Important:*  The <margins> of an <object> include the 2- <pixel> space required for the focus border, even if the <lookAndFeel> is not "Motif". This means that 2 is the smallest usable margin, rather than zero. For example, if the <margins> of a <field(keyword)> is set to zero, a few <pixels> at the edge of the <field(object)|field's> text may be cut off.

The <margins> setting of an <image>, <player>, or <scrollbar> has no effect.

References: topMargin (property), pixels (property), formattedWidth (property), textAlign (property), formattedHeight (property), wideMargins (property), boundingRect (property), rectangle (property), rightMargin (property), bottomMargin (property), label (property), lookAndFeel (property), leftMargin (property), traversalOn (property), image (keyword), integer (keyword), button (keyword), scrollbar (keyword), graphic (keyword), player (keyword), field (keyword), control (keyword), group (command), field (object), object (object), control (object), property (glossary), pixel (glossary), group (glossary), Unix (glossary), active control (glossary), non-negative (glossary), integer (glossary)

Tags: ui
