Admin Production ni-theme
Current Publication

InstallPanelCallback

LabWindows/CVI

InstallPanelCallback

int InstallPanelCallback (int panelHandle, PanelCallbackPtr eventFunction, void *callbackData);

Purpose

Installs a panel callback.

InstallPanelCallback takes a panel handle, the name of the event function, type PanelCallbackPtr, that processes events for that panel, and callback data of any type.

After you install the callback, the event function is called whenever the user generates an event on the panel.

The event function receives the panel handle of the panel generating the event; the type of the event, such as a left mouse click, and any additional event data, such as the mouse position at the time of a left mouse click; and the callback data for processing.

You do not need to call InstallPanelCallback if you already associated a callback function with the panel in the User Interface Editor.

Callbacks are initiated through RunUserInterface or GetUserEvent.

Note  To uninstall the callback, pass NULL for eventFunction.

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.
eventFunction PanelCallbackPtr Name of the function that processes the panel events.

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

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

The event function receives the panel handle of the panel generating the event; the type of the event, such as a left mouse click, and any additional event data, such as the mouse position at the time of a left mouse click; and the callback data for processing. User callbacks must always return 0 unless they intend to swallow the event to which they are responding. To swallow the event, the callback should return 1.

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: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Examples

Refer to the following examples that use the InstallPanelCallback function:

  • apps\uirview\uirview.cws

    Open example
  • userint\events.cws

    Open example