GetCtrlVal
- Updated2023-02-21
- 2 minute(s) read
GetCtrlVal
int GetCtrlVal (int panelHandle, int controlID, void *value);
Purpose
Obtains the current value of a control.
When the control ID is for a list box or ring control, GetCtrlVal returns the value of the currently selected list item. To obtain the index of the selected list item, use GetCtrlIndex.
Supported Controls
You can use GetCtrlVal with binary switches, color numerics, LEDs, list boxes, numerics, picture buttons, picture rings, radio buttons, rings, numeric slides, ring slides, strings, text boxes, text buttons, text messages, timers, toggle buttons, trees.
Parameters
Input | ||||||||||||||||||||||||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
panelHandle | int | Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel. | ||||||||||||||||||||||||||||||||||||||||
controlID | int | 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 functions such as NewCtrl and DuplicateCtrl. | ||||||||||||||||||||||||||||||||||||||||
Output | ||||||||||||||||||||||||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
value | void * | The current value of the control. The data type of value must match the data type of the control.
|
Return Value
Name | Type | Description |
status | int | Return value indicating whether the function was successful. A negative number indicates that an error occurred. |
Additional Information
Library: User Interface Library
Include file: userint.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later
Example
Refer to userint\picture.cws for an example of using the GetCtrlVal function.