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.

Parameters

Input
Name Type Description
panelHandle integer Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID integer 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.
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 integer 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.
area integer 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_COLUMN_SIZE_AREA
VAL_GRID_COLUMN_SIZE_AREA
VAL_VSCROLL_AREA
VAL_HSCROLL_AREA
column integer 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.

Return Value

Name Type Description
status integer Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Code Error Message String
xx Success