User Tools

Site Tools


setparentcontrol_set_parent_control_.htm
Navigation:  ABC Library Reference > WindowResizeClass > WindowResizeClass Methods >====== SetParentControl (set parent control) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

SetParentControl( control [,parent] )

blk2blue.jpg

SetParentControl Sets the parent for a window control.
control An integer constant, variable, EQUATE, or expression containing a control number. The Resize method rescales the control based on the coordinates of the parent.
parent An integer constant, variable, EQUATE, or expression containing a control number. The Resize method rescales the control based on the coordinates of the parent. If omitted, parent defaults to the WINDOW.

The SetParentControl method sets the parent for a window control. The Resize method rescales the control based on the coordinates of the 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.

The SetParentDefaults method intelligently sets the appropriate parent for each window control so you only need to use SetParentControl if SetParentDefaults sets an inappropriate parent.

The GetParentControl method returns the parent control number for a control.

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:     GetParentControl, Resize, SetParentDefaults

setparentcontrol_set_parent_control_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1