Sending input focus to a table cellΒΆ

table_focus_cell()

Send input focus to a specified table cell


SYNTAX

table_focus_cell(table_id, row, column[, view_row])

Sends input focus to the specified cell. The row and column are the co-ordinates of the cell, counting from 1. The row must be an integer value no greater than the number of visible rows allocated to the table; the topmost visible row is row 1.

The optional view_row parameter is an integer in the range 1-n where n is the number of visible rows in the table (assigned by the rows = clause). If possible, the line that contains the line that contains the focused cell is positioned on this row. For example, if the table has 5 rows and view_row is set to 3, the selected row will be displayed in the middle row.

The cell receiving focus need not be currently visible; it will be scrolled into view if necessary.

Return values

CELL_NOT_FOCUSED (0)

Focus refused (e.g. the gain focus event function returned ERROR).

CELL_FOCUSED_IN_VIEW (1)

The cell was focused and is in view.

CELL_FOCUSED_INTO_VIEW (2)

The cell was focused by scrolling it into view.

Any negative value

Error (e.g. parameter out of range).


EXAMPLE

Check which tab window is selected, then set focus to a table cell in that tab:

if (CurrentTab = "winTab1") {
     table_focus_cell(Table1, 1, 2)
}

if (CurrentTab = "winTab2") {
     table_focus_cell(Table2, 1, 2)
}

RELATED TOPICS

Tables

Table size

Listbox and table functions

Editing table values at run time

setfocus()