Selecting or deselect a table or listbox lineΒΆ

set_selected()

Select/deselect a table or listbox line


SYNTAX

set_selected (control_id, line, TRUE | FALSE)

Selects or deselects the specified line. The control_id must be a table_id or listbox_id.

If TRUE is specified, the line is selected.

If FALSE is specified, the line is deselected.

The line is a number indicating the line to be selected or deselected. Line numbers start from 1. If line is 0, the function sets the state of all lines in the listbox or table.

Tables and LIST_BOX type listboxes are by default single-selection, but may be set to allow multiple selections by means of the mode flag EM_MULTIPLE. Unless this flag is set, an attempt to set all lines to TRUE is ignored. Attempts to set all lines of any other type of listbox to TRUE are also ignored.

If the control_id is not a table or LIST_BOX type listbox with the EM_MULTIPLE mode flag, and TRUE is specified, the previously selected line is deselected.

The first element of a LIST_BUTTON or LIST_EDIT type box is normally selected as the default. To change this, use this function to set the required line to TRUE.

A selected line is normally displayed with white text on a blue background. The style flag WS_HLIGHT_DARKEN, which darkens a selected line, is available for use with tables. See Table style.

The function returns zero normally, or -1 if the control_id is not a valid object.

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_set_selected_key() function is available for use with file-driven tables.


EXAMPLES

set_selected(FieldPropsTable, 0, FALSE)
set_selected(LTList, 1, TRUE)

RELATED TOPICS

Tables

Listboxes

Listbox types

Listbox and table functions