DistributeCtrls

int DistributeCtrls (int panel, int direction, int spacing, int *position, int gapOrAreaSize, int numberOfCtrls, . . .);

Purpose

This function evenly distributes the specified controls either horizontally or vertically.

Parameters

Input
Name Type Description
panel integer The specifier for a particular panel that is currently in memory.

This handle will have been returned by the LoadPanel, NewPanel, or DuplicatePanel function.
direction integer This parameter controls the direction in which the controls will be distributed.
spacing integer This parameter controls how the controls will be distributed.

Select "Fixed Gap Between Controls" to place a gap the size of the value passed to gapOrAreaSize between each control.

Select "Distribute Over Area" to have your first control start at the value passed to position and have the last control end on the value passed to position plus the value passed to gapOrAreaSize. This has the effect of evenly distributing the controls in the area from position to position+gapOrAreaSize.
gapOrAreaSize integer If the spacing parameter is set to "Fixed Gap Between Controls" then this parameter specifies the number of pixels of gap to place between each control.

If spacing parameter is set to "Distribute Over Area" then this parameter specifies the size of the area to distribute over.
numberOfCtrls integer Specifies how many control IDs are being passed to the function.

Pass zero for this parameter if you want the function to continue through the control argument list until it finds a control ID of zero. This feature makes it unnecessary to count the number of controls passed if the last control ID passed is always a zero.
controlList any type (passed by value) This parameter takes a variable number of comma separated control ID arguments.

If the value of numberOfCtrls is zero, then the last control ID passed should be a zero in order to mark the end of the list of controls. Otherwise, numberOfCtrls should be set to the number of control IDs passed.
Output
Name Type Description
position integer * This parameter specifies where to start distributing controls.

The position specifies the topmost position or the leftmost position of the distributed controls, depending on the value passed the the direction parameter.

The coordinate of the bottom edge or right edge of the last control is returned in this parameter.

Return Value

Name Type Description
status integer Returns 0 if the function succeeded or a negative error code if the function failed.

The possible negative error codes are:

–1 to –999 A User Interface Library error code. (Constants are available in userint.h.)

A description of any of these error codes can be obtained using the GetGeneralErrorString function in the toolbox.fp instrument driver.