Type: Integer
Availability: Read or write at any time
The parentAspect property of the Control class contains the aspect of the control to its parent. The default value for this property is ParentAspect_None (0). For details about obtaining the bottom and right offsets of the control from its parent, see the Control class parentBottomOffset and parentRightOffset properties.
The parentAspect property provides the following features for any control other than a Sheet, StatusLine, JadeDockBar, or JadeDockContainer control, to enable you to define resize and reposition actions that take effect without having to write any logic.
Determines whether the control stretches horizontally, vertically, or both horizontally and vertically with the parent as the parent size changes.
For horizontal stretching, the left position remains fixed and the control width is changed so that the distance from the right edge of the control to the right of the client area of the parent remains constant. For vertical stretching, the top position remains fixed and the control height is changed so that the distance from the bottom edge of the control to the bottom of the client area of the parent remains constant.
Determines whether the control is anchored to the right, bottom, or both to the right and bottom of the parent as the size of the parent changes.
For horizontal anchoring, the left position of the control is changed so that the distance from the right edge of the control to the right of the client area of the parent remains constant. For vertical anchoring, the top position of the control is changed so that the distance from the bottom edge of the control to the bottom of the client area of the parent remains constant.
Determines whether the control is centered horizontally, vertically, or both horizontally and vertically within the client area of the parent as the size of the parent changes.
The Control class constants are listed in the following table.
Constant | Integer Value |
---|---|
ParentAspect_None | 0 |
ParentAspect_StretchRight | #1 |
ParentAspect_StretchBottom | #2 |
ParentAspect_StretchBoth | #3 |
ParentAspect_AnchorRight | #4 |
ParentAspect_AnchorBottom | #8 |
ParentAspect_AnchorBoth | #c |
ParentAspect_CenterHorz | #10 |
ParentAspect_CenterVert | #20 |
ParentAspect_CenterBoth | #30 |
The property values are a bit mask of valid combinations. For example, you can anchor a control to the bottom of its parent and also have it stretch horizontally as the parent width varies, by setting the property value to ParentAspect_StretchRight + ParentAspect_AnchorBottom.
Similarly, you can center a control vertically and have it stretch horizontally as the parent width varies, by setting the property value to ParentAspect_CenterVert + ParentAspect_StretchRight. However, not all combinations are compatible, and an invalid combination results in an exception being raised at run time.
The following values for parentAspect are mutually incompatible and you can include only one.
ParentAspect_StretchRight
ParentAspect_AnchorRight
ParentAspect_CenterHorz
The following values for parentAspect are mutually incompatible and you can include only one.
ParentAspect_StretchBottom
ParentAspect_AnchorBottom
ParentAspect_CenterVert
When using the parentAspect property, note the following points.
The property is ignored:
If the alignment of the control is already specified by using the alignContainer or alignChildren property of a Frame, JadeDockBar, or JadeDockContainer control; for example, a frame that has the alignContainer property set to AlignContainer_Width (3).
For direct children of a JadeDockContainer control, which always automatically positions its children. Children that have no specific alignment are positioned in rows or columns so that they do not overlap.
The JadeDockContainer also adjusts the position of the children to minimize the height or width of the container, when appropriate.
For a JadeDockBar control except when the container has the alignChildren property set to AlignChildren_None (0). This setting means that it is your responsibility to position the children.
All other settings cause the children to be automatically positioned.
Some controls have fixed heights and widths. Any stretching is ignored for those cases, as follows.
Height
A Button control that is automatically sized to its picture property
Any fixed height CheckBox control
Any fixed height ComboBox control
A Label control that is automatically sized
Any fixed height OptionButton control
A Picture control that automatically sizes to its picture property; that is, Stretch_ControlTo (2) and Stretch_Proportional (3)
An automatically positioned Sheet or StatusLine control
Width
The parentAspect property values can conflict with the relative property requirements. Where they do, the relative property setting is ignored, as follows.
If ParentAspect_StretchRight applies, the relativeLeft and relativeWidth properties are ignored
If ParentAspect_StretchBottom applies, the relativeTop and relativeHeight properties are ignored
If ParentAspect_AnchorRight applies, the relativeLeft property is ignored
If ParentAspect_AnchorBottom applies, the relativeTop property is ignored
For a ListBox or TextBox control with the integralHeight property set to true, the actual distance between the bottom edge of the control and the bottom of the client edge of the parent varies, as the height of the control is rounded to the nearest integral line height.
If logic changes the position or size of the control, the distances to the edges of the parent of the control are re-evaluated and used from then on.
You can also use the Form class minimumHeight and minimumWidth properties to prevent the user resizing the form and causing controls to overlap or the form to have no effective height or width.