- Use conditions
- The different types of column indices
- Using MouseXPos and MouseYPos
In french: TableInfoXY
Returns for a given position in a Table or TreeView Table control (coordinates of a control point):
- the name of the column displayed for the specified position.
- the index of the row or column for the specified position.
// Optional click code on the TABLE_TABLE1 control
MyRow is int
MyColumn is string
MyRow = TableInfoXY(TABLE_TABLE1, tiLineNumber, MouseXPos(), MouseYPos())
MyColumn = TableInfoXY(TABLE_TABLE1, tiColName, MouseXPos(), MouseYPos())
Trace("You have selected the cell (" + MyColumn+", " + MyRow + ")")
// Index of the row at point (50, 100) of the "TABLE_ProductTable" control
ResInfo = TableInfoXY(TABLE_ProductTable, tiLineNumber, 50, 100)
<Result> = TableInfoXY(<Table control> , <Type of information> , <X> , <Y>)
<Result>: String, integer or boolean
- Requested information.
- An empty string ("") if there is no column name.
- -1 if there is no column index or row number, or if the specified position corresponds to an empty row or column.
<Table control>: Control name
Name of the Table or TreeView Table control to be used.
If this parameter corresponds to an empty string (""), the control to which the current event belongs will be used.
<Type of information>: Integer constant
Requested type of information:
|tiColNumber||Column creation index.|
|tiOnButtonCollapseExpand||"+/-" buttons to expand/collapse a row. In this case, <Result> is set to True (1). |
This constant is only available for TreeView Table controls.
|tiOriginScreen||The coordinates to be analyzed are relative to the screen. |
Reminder: By default, the coordinates to be analyzed are relative to the Table control: (0,0) corresponds to row 1, column 1 of the Table control (scrollbars positioned at the origin).
This constant cannot be used on its own.
X-coordinate (in pixels) to be analyzed. This coordinate is given in relation to the control (if the tiOriginScreen constant is not specified).
Y-coordinate (in pixels) to be analyzed. This coordinate is given in relation to the control (if the tiOriginScreen constant is not specified).
TableInfoXY can be used on:
- a Table or TreeView Table control based on a data file.
- a Table or TreeView Table control populated programmatically.
- a single-selection or multiselection control.
The different types of column indices
There are 2 types of indices for columns:
- Index of the visible position: index of the column when the window is executed.
- Creation index: index of the column when the table is created in the window editor.
These indices change if the user moves the columns.
Additionally, if the horizontal scrollbar is used, TableInfoXY takes this change into account.
Using MouseXPos and MouseYPos
To use MouseXPos
in the X and Y parameters of the function, make sure that a single mouse click will trigger the execution of the code containing this function.
For example, the event "Selecting a row" of a Table control can be started by a simple click but also by a keyboard selection. Therefore, MouseXPos
should not be used in this event. Use an optional event instead. In this example, use the optional event "Left button down" on aTable control.
Business / UI classification: UI Code
This page is also available for…