Admin Production ni-theme
Current Publication

EnableExtendedMouseEvents

LabWindows/CVI

EnableExtendedMouseEvents

int EnableExtendedMouseEvents (int panel, int ctrl, double minimumEventInterval_Sec);

Purpose

Note Note  This function has been superseded by the following built-in LabWindows/CVI events: EVENT_MOUSE_POINTER_MOVE, EVENT_LEFT_CLICK_UP, and EVENT_RIGHT_CLICK_UP. Use EnableExtendedMouseEvents if you need to get event information when a user releases the left or right mouse buttons outside of a LabWindows/CVI panel.

Enables a control to receive the following extended mouse events in addition to the built-in mouse events.

EVENT_MOUSE_MOVE—This event is sent when the mouse moves, regardless of whether a mouse button is pressed down or whether the mouse is over the control for which you enable extended mouse events. You can specify the minimum interval between mouse move events.
EVENT_LEFT_MOUSE_UP—This event is sent when a user releases the left mouse button over a control, panel, or outside of a LabWindows/CVI panel.
EVENT_RIGHT_MOUSE_UP—This event is generated when a user releases the right mouse button over a control, panel, or outside of a LabWindows/CVI panel.

The following events are built–in LabWindows/CVI mouse events:

EVENT_LEFT_CLICK
EVENT_LEFT_DOUBLE_CLICK
EVENT_RIGHT_CLICK
EVENT_RIGHT_DOUBLE_CLICK
EVENT_MOUSE_POINTER_MOVE
EVENT_LEFT_CLICK_UP
EVENT_RIGHT_CLICK_UP

The built-in mouse events occur when the mouse button is pressed down.

For each extended and built-in event:

eventData1 is the vertical mouse coordinate
eventData2 is the horizontal mouse coordinate

Notes  
  • Using this function generates chained callback functions. Use the appropriate callback data function if you want to get or set callback data.
  • You can call this function repeatedly to change the interval of a control's extended mouse events.
  • Extended mouse events are implemented using timer controls. Therefore, timer controls must be enabled if you use extended mouse events. If you call SuspendTimerCallbacks, extended mouse events do not work properly.

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.
ctrl int The ID of the control whose callback function will receive extended mouse events.

The ID is 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.
minimumEventInterval_Sec double The minimum interval, in seconds, between extended mouse events of the same type. If you set this parameter to 0.0, then you receive mouse events as frequently as possible.

For example, if the minimum interval is 2 seconds, then you could receive at most one EVENT_MOUSE_MOVE, one EVENT_LEFT_MOUSE_UP, and one EVENT_RIGHT_MOUSE_UP every 2 seconds.

Return Value

Name Type Description
status int Returns zero if the extended mouse events were enabled for the control, or a negative error code if the function failed.

The possible negative error codes are:

–1 to –999 A User Interface Library error code. (Constants are available in userint.h.)

A description of any of these error codes can be obtained using the GetGeneralErrorString function in the toolbox.fp instrument driver.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Example

Refer to userint\GraphAnnotations.cws for an example of using the EnableExtendedMouseEvents function.