Admin Production ni-theme
Current Publication

DistributeCtrls

LabWindows/CVI

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 int 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 int Specify VAL_TB_VERTICAL_DISTRIBUTION or select Vertically to distribute the controls vertically.

Specify VAL_TB_HORIZONTAL_DISTRIBUTION or select Horizontally in the function panel distribute the controls horizontally.
spacing int Specify VAL_TB_FIXED_GAP_SPACING or select Fixed Gap Between Controls in the function panel to place a gap the size of the value passed to gapOrAreaSize between each control.

Specify VAL_TB_AREA_SPACING or select Distribute Over Area in the function panel 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 int If you set the spacing parameter to Fixed Gap Between Controls or VAL_TB_FIXED_GAP_SPACING, this parameter specifies the number of pixels of gap to place between each control.

If you set the spacing parameter to Distribute Over Area or VAL_TB_AREA_SPACING, this parameter specifies the size of the area to distribute over.
numberOfCtrls int 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 ... 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 int 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 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 int 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.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later