GetTableCellFromPoint
int GetTableCellFromPoint (int panelHandle, int controlID, Point panelCoordinates, Point *cell);
Purpose
Converts panel coordinates into a table control cell.
GetTableCellFromPoint returns a cell containing the indices {0, 0} if the specified coordinates lie outside the cell grid.
Supported Controls
You can use GetTableCellFromPoint with table 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. |
panelCoordinates | Point | A Point structure specifying the panel coordinates. The Point structure is defined as follows: typedef struct { int x; int y; } Point; The values in the Point structure are in terms of pixel coordinates. The origin (0,0) is the upper left corner of the panel. You can create a Point without having to declare a variable by using the following function: Point MakePoint (int x, int y); Example CodeGetTableCellFromPoint (panelHandle, controlID, MakePoint (20, 30), &cell); This function can return a cell that is scrolled out of view. If you want to restrict the specified coordinates to the visible portion of the table, you must use the following code: GetCtrlAttribute (panelHandle, controlID, ATTR_GRID_AREA_TOP, &top); |
Output | ||
Name | Type | Description |
cell | Point | A Point structure indicating the row and column of the cell corresponding to
the specified value. The Point structure is defined as follows: typedef struct { int x; int y; } Point; The function writes the one-based column index of the corresponding cell into the x field of the structure, and the one-based row index of the corresponding cell into the y field of the structure. If the specified coordinates lie outside the cell grid, the function returns a cell containing the indices {0, 0}. This function can return a cell that is scrolled out of view. If you want to restrict the specified coordinates to the visible portion of the table, you must use the following code: GetCtrlAttribute (panelHandle, controlID, ATTR_GRID_AREA_TOP, &top); |
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 5.5 and later