GetIndexFromPoint
int GetIndexFromPoint (int panelHandle, int controlID, Point point, int *index, int *area, int *column);
Purpose
Returns the zero-based index of the item and column that contains the point you specify. Also returns the specific area of the control.
Supported Controls
You can use GetIndexFromPoint 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 control. 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 GetIndexFromPoint. In this example, eventData1 is the vertical mouse position, and eventData2 is the horizontal mouse position. GetIndexFromPoint (panelHandle, controlID, MakePoint (eventData2, eventData1), &index, &area, &column); |
Output | ||
Name | Type | Description |
index | int |
Returns the zero-based index of the item that contains the point you specify. Returns the last index if the point is below the last item. Returns the first index if the point is before the first item. You can pass NULL for this parameter. |
area | int |
Returns one of the following constants to indicate which area of the tree contains the specified point: VAL_OTHER_AREA VAL_ITEM_PLUS_MINUS_AREA VAL_ITEM_MARK_AREA VAL_ITEM_IMAGE_AREA VAL_ITEM_LABEL_AREA VAL_COLUMN_LABEL_AREA VAL_CELL_AREA VAL_CELL_MENU_ARROW_AREA VAL_CELL_BUTTON_AREA VAL_CELL_CHECK_BOX_AREA VAL_CELL_COLOR_PICKER_AREA VAL_COLUMN_SIZE_AREA VAL_GRID_COLUMN_SIZE_AREA VAL_VSCROLL_AREA VAL_HSCROLL_AREA You can pass NULL for this parameter. |
column | int |
If the control is a tree, the column returns the zero-based index of the column that contains the point you specify. Returns the last index if the point is after the last column. If the control is a listbox, the column is set to zero. You can pass NULL for this parameter. |
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 7.0 and later
Example
Refer to userint\TreeBusDigitalGraph.cws for an example of using the GetIndexFromPoint function.