Checking whether a table/listbox line is selectedΒΆ

is_selected()

Determine whether a listbox/table line is selected


SYNTAX

is_selected(control_id, line)

Checks whether the specified line of a listbox or table is selected or deselected. The control_id must be a table_id or listbox_id. Line numbers start from 1.

Returns a non-zero value if the specified line is selected, otherwise zero. The return value for LIST_EDIT type listboxes is not defined.

Note

This function should not be used with tables whose source object is a file. It is only reliable if the specified line is visible, and the function may not be supported for file-driven tables in future releases. The **** table_is_selected_key() function is available for use with file-driven tables.


EXAMPLE

This function counts the selected lines in a table:

!function CountSelLines(Table) {
!temp Row,,i2

     NumSelLines = 0
     while (Row <= Table->max_line) {
          if (is_selected(Table, Row)) then NumSelLines ++
          Row ++
     }

     return
}

RELATED TOPICS

Tables

Listboxes

Listbox and table functions