Admin Production ni-theme
Current Publication

GetLegendItemFromPoint

LabWindows/CVI

GetLegendItemFromPoint

int GetLegendItemFromPoint (int panelHandle, int controlID, Point point, int *item);

Purpose

Returns the trace index or plot handle of the strip chart or graph legend item that contains the specified point.

Supported Controls

You can use GetLegendItemFromPoint with the following controls:

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.
point Point A Point structure specifying the coordinates of a point in the legend.

The Point structure is defined as follows:

typedef struct
   {
   int x;
   int y;
   } Point;


You can create a Point without having to declare a variable by using the following function:

Point MakePoint (int x, int y);

The following example shows how to use MakePoint with GetLegendItemFromPoint. In this example, eventData1 is the vertical mouse position, and eventData2 is the horizontal mouse position.

GetLegendItemFromPoint (panelHandle, controlID, MakePoint (eventData2, eventData1), &item);

Output
Name Type Description
item int If the control is a strip chart, this is the trace index that contains the point you specify. If the control is a graph, this is the plot handle. Returns zero if the point is not over a legend item.

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 9.0 and later