Init (initialize the WindowResizeClass object)

Top  Previous  Next

 

Init( [strategy] [,minimum size] [,maximum size] )

Init

Initializes the WindowResizeClass object.

strategy

An integer constant, variable, EQUATE, or expression indicating the overall strategy for resizing and repositioning all the controls on the window. If omitted, strategy defaults to AppStrategy:Resize, which rescales all controls in proportion to the parent.

minimum size

An integer constant, variable, EQUATE, or expression indicating the minimum size of the window. A value of one (1) sets the minimum window size to its design size. If omitted, minimum size defaults to zero (0), which indicates no minimum.

maximum size

An integer constant, variable, EQUATE, or expression indicating the minimum size of the window. A value of one (1) sets the maximum window size to its design size. If omitted, maximum size defaults to zero (0), which indicates no maximum.

The Init method initializes the WindowResizeClass object and sets the overall strategy for resizing and repositioning window controls. You can use the SetStrategy method to override the overall strategy for individual controls.

Implementation:

The Init method adds the IMM attribute to the WINDOW.

If the strategy parameter is present, Init applies a strategy to each control based on the parameter value. If the strategy parameter is absent, Init applies the default strategy to each control. The default strategy is to rescale all control coordinates (x, y, width, and height) proportionally with the parent.

The parent may be the WINDOW containing the control, or it may be another control on the WINDOW. The SetParentControl and SetParentDefaults methods determine the parent for a given control.

The strategy parameter EQUATEs are declared in RESIZE.EQU as follows:

 ITEMIZE(0),PRE(AppStrategy)

Resize         EQUATE  !Rescale all proportionally

Spread         EQUATE  !Resize surface controls, move others

Surface        EQUATE  !Max surface controls, move others

NoResize       EQUATE  !Does not resize any controls

Centered       EQUATE  !Reposition and center controls

 END

The purpose and effect of these strategies are:

Resize

Scales all window coordinates by the same amount as the parent, thus preserving the relative sizes and positions of all controls. This is the default strategy.

Surface

Makes the most of the available pixels by positioning other controls to maximize the size of LIST, SHEET, PANEL, and IMAGE controls.

Spread

Preserves the design-time look and feel of the window by applying the following strategies by control type:

Centered

Does not resize the controls, but repositions them relative to the window resize.

BUTTON

Horizontal and Vertical position (X and Y coordinates) are "fixed" relative to the nearest parent border; width and height are unchanged.

RADIO

Horizontal and vertical position are scaled with the parent, but width and height are unchanged.

CHECK

Horizontal and vertical position are scaled with the parent, but width and height are unchanged.

ENTRY

Width, horizontal and vertical position are scaled with the parent, but height is unchanged.

COMBO+DROP

Width, horizontal and vertical position are scaled with the parent, but height is unchanged.

LIST+DROP

Width, horizontal and vertical position are scaled with the parent, but height is unchanged.

SPIN

Width, horizontal and vertical position are scaled with the parent, but height is unchanged.

Other

All coordinates are scaled with the parent.

Even though LIST and COMBO controls may be resized, the column widths within them are not resized. However, the right-most column does expand or contract depending on the available space.

Example:

OPEN(window)

Resizer.Init(AppStrategy:Surface)      !initialize Resizer object

ACCEPT

 CASE EVENT()

 OF EVENT:CloseWindow                  ! on close window,

  Resizer.Kill                         ! shut down Resizer object

 OF EVENT:Sized                        ! on sized window,

  Resizer.Resize                       ! resize & reposition controls

 END

END

See Also:     SetParentControl, SetParentDefaults, SetStrategy SetAnchor