Navigation: ABC Library Reference > WindowResizeClass > WindowResizeClass Methods >====== SetParentDefaults (set default parent controls) ====== | |
SetParentDefaults, VIRTUAL
The SetParentDefaults method intelligently sets the appropriate parent for each window control. The Resize method rescales each control based on the coordinates of its parent.
This lets you rescale a particular control based upon a related control's coordinates rather than on the window's coordinates. This is appropriate when the strategy applied to the parent control causes it to be scaled disproportionately from the window. For example, controls within a GROUP structure whose size is “locked” may be rescaled to fit the GROUP's coordinates rather than the window's coordinates.
You may use the SetParentControl method to set the parent for a single control.
Implementation:
The SetParentDefaults method considers each control's coordinates. If the control's coordinates fall within the coordinates of another control, the SetParentDefaults method sets the “outer” control as the parent of the “inner” control.
The Init method calls the SetParentDefaults method when the resize strategy is AppStrategy:Surface.
Example:
window WINDOW('Nested Controls'),AT(,,165,97),IMM,GRAY,MAX,RESIZE
GROUP('OuterGroup'),AT(5,3,154,92),USE(?OuterGroup),BOXED
BUTTON('Button 1'),AT(14,23),USE(?Button1)
ENTRY(@s20),AT(60,24),USE(Entry1)
GROUP('InnerGroup'),AT(11,49,141,38),USE(?InnerGroup),BOXED
CHECK('Check 1'),AT(32,64),USE(Check1)
CHECK('Check 2'),AT(91,64),USE(Check2)
END
END
END
CODE
OPEN(window)
Resizer.Init(AppStrategy:Spread) !initialize Resizer object
Resizer.SetParentDefaults !set parents for all controls
Resizer.SetParentControl(?Button1,?OuterGroup) !override parent for a control
Resizer.SetParentControl(?Check1,?InnerGroup) !override parent for a control
Resizer.SetParentControl(?Check2,?InnerGroup) !override parent for a control
See Also: Resize, SetParentControl