LabWindows/CVI

ColorPicker_InstallCallback

int ColorPicker_InstallCallback (int panel, int control, ColorPickerCallbackPtr callback, void *callbackData);

Purpose

Specifies a callback function to receive color picker control events and the callback data to pass to that function. You can pass NULL in the callback parameter to remove an existing callback function.

Parameters

Input
Name Type Description
panel int The specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
control int The ID you specified as the canvas parameter in the ColorPicker_Convert function call. This value must be the same as the defined constant, located in the .uir header file, that you assigned to the original canvas control.
callback ColorPickerCallbackPtr Name of the function that processes the color picker control events.

The event function, type ColorPickerCallbackPtr, takes the following form:

int CVICALLBACK EventFunctionName (int panelHandle, int controlID, int event, void *callbackData, int eventData1, int eventData2, int eventData3);

The event function receives the panel handle and control ID of the control generating the event, the type of the event, any additional event data, and the callback data for processing.

eventData1 indicates the index of the color cell that changed. eventData2 indicates whether a custom color cell or fixed color cell changed. eventData3 indicates the color the cell is changing to.

User callbacks must always return 0 unless you want to swallow the event. Return 1 to swallow the event.

Note  To uninstall the callback, pass NULL for this parameter.
callbackData void * Points to data that you define. The callback function receives the pointer.

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: Color Picker Control

Include file: custctrl\color_picker.h

LabWindows/CVI compatibility: LabWindows/CVI 9.0 and later

Example

Refer to userint\custctrl\colorpicker\colorpickerdemo.cws for an example of using the ColorPicker_InstallCallback function.