Was this helpful?
Gravity
Because gravity is an attribute of the FormField class, every field has an alignment, or gravity, attribute. However, the gravity attribute is applicable only if a field's immediate parent is a matrix field, a stack field, or a subform.
Because a column field is a stack field, gravity also applies if a field's parent is a column field. Moreover, the form itself is a frame form; and because a frame form is a subform, gravity applies to a field whose parent is the form.
The gravity attribute is not particularly useful when a field's parent is the form itself. (The exception is FA_TOPLEFT.) For example, if you place a button field on a frame and set gravity to FA_CENTER, you “lose” the field because it will be centered in the 24-inch by 24-inch form. Consequently, you are forced to scroll the frame to locate the field. Gravity is quite useful, however, when a field's parent is a matrix field, a stack field, or a subform (other than the form itself).
The ChildGravity attribute is even much more useful than the Gravity attribute. Because gravity applies only when the immediate parent is a matrix field, a subform, or a stack field, only matrix fields, subforms, and stack fields (and their subclasses) have the ChildGravity attribute. For more information, see Matrix Field Properties.
Note:  For more information about the FormField class and using the gravity attribute, see the Language Reference Guide and the Programming Guide.
Set Gravity
You can set a field's gravity in the Frame Editor.
To set a field's gravity
1. Open your frame in the Frame Editor (see Open an Existing Frame).
2. Select a field in a matrix field, stack field, or subform.
3. Click the Gravity (or ChildGravity) property in the Property Inspector.
Note:  You cannot move a child field away from its default position unless the parent field's Gravity property is set to FA_NONE.
4. Select one of the valid alignment options:
FA_DEFAULT
FA_NONE
FA_TOPCENTER
FA_TOPLEFT
FA_TOPRIGHT
FA_CENTERLEFT
FA_CENTER
FA_CENTERRIGHT
FA_BOTTOMCENTER
FA_BOTTOMLEFT
FA_BOTTOMRIGHT
Alternatively, select one of the alignment commands from the Layout Gravity submenu.
Last modified date: 06/25/2024