LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

GetCtrlVal

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.

Note Note  You cannot call GetCtrlVal for controls not listed in the following table.
Control Data Type
Binary switch control Data type you specify
Color numeric control unsigned long int
LED control int
List box control Data type you specify
Numeric control Data type you specify
Numeric slide control Data type you specify
Picture button control int (picture toggle buttons only)
Picture ring control Data type you specify
Radio button control int
Ring control Data type you specify
Ring slide control Data type you specify
String control char []
Text box control char []
Text button control int
Text message control char []
Timer control double
Toggle button control int
Tree control Data type you specify

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.

Was this information helpful?