# DistributeCtrlsInList

int DistributeCtrlsInList (int panel, ListType listOfControls, int direction, int spacing, int *position, int gapOrAreaSize);

## Purpose

This function evenly distributes a list of 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.
listOfControls | ListType | This parameter should be a list of control IDs (see the Lists... class of functions).
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.
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.