Checking for unsaved input in a textbox table cell (table_check_input)ΒΆ

table_check_input()

Checking a table for unsaved input in a textbox cell


SYNTAX

table_check_input(table_id, option)

Checks whether there is unsaved input in a textbox cell in an editable table. A cell is assigned the textbox type by means of the cell_properties record.

option must be one of the following (defined in <sculptor.h>):

TABLE_TEST_INPUT (0)

Returns TRUE if there is unsaved input in a cell, otherwise FALSE. This option does not attempt to save the data.

TABLE_SAVE_INPUT (1)

If there is unsaved input in a cell, attempts to save it. The function then returns one of the following values:

0

Nothing to save.

1

Data saved.

-1

There was unsaved data, but it invalid and could not be saved.

A typical use of this function is during a right mouse event where it might not be safe to open a popup menu if a cell contains unsaved data.


EXAMPLE

This table event function tests for unsaved data before allowing a popup menu to open:

!function FPTEvent(EventCode, Table, Line, Column, Arg5, Arg6, Arg7, Arg8) {

!temp XWin,,i2
!temp YWin,,i2

     if (EventCode = EV_RIGHT_MOUSE_UP) \
       and (table_check_input(FieldPropsTable, TABLE_TEST_INPUT) = FALSE) {
          XWin = Arg7
          YWin = Arg8
          move cursor to XWin, YWin in wintask
          open wintask.FieldTableMenu
     }
}

RELATED TOPICS

Tables

Table events and functions

Table cell properties

Listbox and table functions