ParentField Attribute
Data Type: CompositeField
4GL Access: RW
The ParentField attribute specifies the direct parent field for a field.
This attribute is useful in applications that build fields dynamically because setting this attribute to a composite field attaches the field to the specified composite field.
Conversely, setting this value to null detaches the field from the form. However, because this is an expensive operation, do this only when you are making a permanent change to the form structure for frame execution. If you want to make a field temporarily invisible, for example, to set some display attributes, set the CurBias attribute temporarily to FB_INVISIBLE.
Attaching a field or detaching a field from a composite field, such as a matrix field, causes the composite field to reconfigure itself, including resizing, to accommodate the new population.
If you create a field dynamically, a common technique is to set the appropriate size, position, outline style, color, font, and other visual characteristics first, then set the ParentField attribute to make all the changes visible at once.
Because intermediate parent components are often used in complex composites such as viewports and table fields, do not use this attribute to determine if a given field is part of another known composite. Instead, use the methods
IsDescendantOf (see
IsDescendantOf Method) or
WhichTableField (see
WhichTableField Method) defined for the FieldObject class.