Form file structure / LAYOUT section |
Defines a re-sizable table designed to display a list of database records.
TABLE [identifier] [ ( attribute [,...] ) ] { title [...] [col-name [|...] ] [...] [aggr-name [|...] ] } END
AGGREGATETEXT, COMMENT, DOUBLECLICK, HIDDEN, FONTPITCH, STYLE, TAG, UNHIDABLECOLUMNS, UNMOVABLECOLUMNS, UNSIZABLECOLUMNS, UNSORTABLECOLUMNS, WANTFIXEDPAGESIZE, WIDTH, HEIGHT.
To create a table view, you must define the following elements in the form file:
When using this layout container with curly braces, the position of the static labels and item tags is automatically detected by the form compiler to build a graphical object displaying a list of records. Column titles for the table list can be defined in the table layout, or as attributes in the definition of the form fields that make up the table columns.
TABLE t1 ( WIDTH = 5 COLUMNS, HEIGHT = 10 LINES )
TABLE { [column1 |column2 |column3 ] [column1 |column2 |column3 ] [column1 |column2 |column3 ] } END
Avoid Tab characters (ASCII 9) inside the curly-brace delimited area. If used, Tab characters will be replaced by 8 blanks byfglform.
TABLE { Title1 Title2 Title3 [column1 |column2 |column3 ] [column1 |column2 |column3 ] [column1 |column2 |column3 ] } END
TABLE { [c1 |c2 |c3 ] [c1 |c2 |c3 ] [c1 |c2 |c3 ] } END ... ATTRIBUTES EDIT c1 = FORMONLY.col1, TITLE=%"Num"; LABEL c2 = FORMONLY.col2, TITLE=%"Name"; CHECKBOX c3 = FORMONLY.col3, TITLE=%"Status", VALUECHECKED="Y", VALUEUNCHECKED="N"; ...
TABLE { Title1 Title2 Title3 [column1 |column2 |column3 ] [ | | ] [column1 |column2 |column3 ] [ | | ] [column1 |column2 |column3 ] [ | | ] } END
ATTRIBUTES EDIT column1 = customer.cust_num; EDIT column2 = customer.cust_name, EDIT column3 = customer.cust_cdate;
SCREEN RECORD listarr( col1, col2, col3 )
INPUT ARRAY custarr FROM listarr.*
The screen array members must match the program array record members: These will be bound by position in DISPLAY ARRAY or INPUT ARRAY. Therefore, the order of the screen array elements matters. However, the position of the TABLE columns can be different from the members of the screen array and program array. So the program array can be defined from the database table definition with the DEFINE LIKE instruction. Further, if you want to omit columns in the TABLE layout, define the these columns as PHANTOM fields, to include them in the definition of the screen array.
By default, the current row in a TABLE is highlighted in display mode (DISPLAY ARRAY), but it is not highlighted in input mode (INPUT ARRAY, CONSTRUCT). You can set decoration attributes of a table with a presentation style of the Table class.
TABLE { [c1 |c2 |c3 ] [c1 |c2 |c3 ] [total ] } END ... ATTRIBUTES ... AGGREGATE total = FORMONLY.total, AGGREGATETYPE=PROGRAM; ...
You can specify the AGGREGATETEXT attribute at the TABLE level, to get a global label for the summary line. The aggregate label will appear on the left in the summary line, if no aggregate text is defined at the aggregate field level. Use presentation style attributes to decorate the summary line.
By default, tables can be re-sized in height. Use the WANTFIXEDPAGESIZE attribute to deny table resizing.With the DOUBLECLICK attribute, you can define a particular action to be sent when the user double-clicks on a row.
By default, a table allows to hide, move, resize columns and sort the list when the user clicks on a column header. The UNHIDABLECOLUMNS, UNMOVABLECOLUMNS, UNSIZABLECOLUMNS, UNSORTABLECOLUMNS attributes can be used to deny these features.
After a dialog execution, the current row may be deselected, depending on the KEEP CURRENT ROW dialog attribute.
SCHEMA videolab LAYOUT ( TEXT="Customer list" ) TABLE ( TAG="normal" ) { [c1 |c2 |c3 |c4 ] [c1 |c2 |c3 |c4 ] [c1 |c2 |c3 |c4 ] [c1 |c2 |c3 |c4 ] } END END TABLES customer END ATTRIBUTES EDIT c1 = customer.cust_num, TITLE="Num"; EDIT c2 = customer.cust_name, TITLE="Customer name"; EDIT c3 = customer.cust_cdate, TITLE="Date"; CHECKBOX c4 = customer.cust_status, TITLE="Status"; END INSTRUCTIONS SCREEN RECORD custlist( cust_num, cust_name, cust_cdate, cust_status ) END