Admin Production ni-theme
Current Publication

SetAttributeForCtrls

LabWindows/CVI

SetAttributeForCtrls

int SetAttributeForCtrls (int panel, int attribute, int value, int numberOfCtrls, ...);

Purpose

This function sets the value of the control attribute in each of the specified controls.

This function can be very useful for sizing and positioning controls when programatically creating dialog boxes.

The following example would set three buttons to be the same width:

Example Code

{

int maxWidth;

AttributeMaxAndMin(thePanel, ATTR_WIDTH, 3, &maxWidth, 0, 0, 0, button1, button2, button3);
SetAttributeForCtrls(thePanel, ATTR_WIDTH, maxWidth, 3, button1, button2, button3);

}

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.
attribute int Specify which attribute to set in the designated controls. The data type of the attribute must be integer (example: ATTR_TOP, ATTR_WIDTH).
value int The value to set the attribute to for all the specified controls.
numberOfCtrls int Specifies how many controls are in the control list.

Pass zero for this parameter if you want the function to continue through the control 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.

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