SetCtrlVal

int SetCtrlVal (int panelHandle, int controlID, ...);

Purpose

Sets the value of a control to a value you specify.

When you call SetCtrlVal on a list box or a ring control, SetCtrlVal sets the current list item to the first item that has the value you specify. To set the current list item through a zero-based index, use SetCtrlIndex.

When you call SetCtrlVal on a text box, SetCtrlVal appends value to the contents of the text box and scrolls the text box to display value. Use ResetTextBox to replace the contents of the text box with value.

Note   This function updates the displayed value immediately. Use SetCtrlAttribute with ATTR_CTRL_VAL to set the control value without immediately updating the displayed value. For this reason, SetCtrlAttribute with ATTR_CTRL_VAL is generally faster than SetCtrlVal. However, if the control in which you are setting the value is the active control in the panel, SetCtrlAttribute with ATTR_CTRL_VAL displays the value immediately.
Note   This function is not valid for graph and strip chart controls.

Parameters

Input
Name Type Description
panelHandle integer Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID integer The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
value Depends on the data type of the control. New value of the control. The data type of value must match the data type of the control.

Return Value

Name Type Description
status integer Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Code Error Message String
xx Success