Editing table values at run timeΒΆ

The values in a table are by default read-only.

image0

The cell_properties clause enables an edit type to be assigned to each column in a table. The different edit types available enable cells in a column to be edited using a textbox, a list button type listbox or list edit type listbox. If a listbox is used, the number of visible rows for the box, the maximum size of the list and values it should contain can also be defined.

The illustration shows part of a table with a list edit type first column, in which the second-row cell is currently being edited.

Additionally, a special edit type value can be set to indicate that the actual edit type for the column is to be set dynamically, each time a cell in the column receives focus. The EV_FOCUS_CELL and EV_NOFOCUS_CELL events are generated whenever a cell gains or loses input focus, and these event functions can be used to change the edit type.

The EV_VALIDATE event is also available, to validate the data in a cell before it loses focus.

If the edit mode flag EM_SYNC_SOURCE is set, the table source object is updated when an editable cell loses focus.

See Table events and functions for full details of these events.

The programmer has additional functions available to control table editing.

The table_focus_cell() function is used to send focus to any currently visible cell in the table.

The table_set_default_data() function sets a default value for a column, which will replace the current value any time a cell in the column is edited.

See $SCULPTOR/demo/controls/etable.f for an example of a table whose cells can be edited.

Note

The cell_properties clause was introduced in Sculptor 5.3. In earlier versions the table_set_type() function was used to set column edit type.


RELATED TOPICS

Tables