User interface programming / Table views |
Define table views in the LAYOUT section of the form definition file.
When using a grid-based layout, the table rows and columns are defined within an area delimited by curly braces. Columns are defined with item tags and form fields. Every column tag must be properly aligned. You typically use a pipe character to separate the column tags.
A table definition using the TABLE layout item:
TABLE { [c1 |c2 |c3 ] [c1 |c2 |c3 ] [c1 |c2 |c3 ] } END
GRID { <GROUP g1 > [f1 ] [f2 ] [ ] < > <TABLE t1 > [c1 |c2 |c3 ] [c1 |c2 |c3 ] [c1 |c2 |c3 ] < > } END
ATTRIBUTES EDIT c1 = customer.cust_id; EDIT c2 = customer.cust_name; EDIT c3 = customer.cust_address; END
LAYOUT STACK TABLE t1(UNMOVABLECOLUMNS) EDIT customer.cust_id; EDIT customer.cust_name; EDIT customer.cust_address; END END END
In a grid-based container, the default width and height of a table are defined by the columns and the number of lines used in the table layout respectively. In a stack-based container,
TABLE { Title1 Title2 Title3 [c1 |c2 |c3 ] [c1 |c2 |c3 ] [c1 |c2 |c3 ] } END
TABLE { [c1 |c2 |c3 ] [c1 |c2 |c3 ] [c1 |c2 |c3 ] } END ... ATTRIBUTES EDIT c1 = customer.cust_id, TITLE=%"label.cust_id"; EDIT c2 = customer.cust_name, TITLE=%"label.cust_name"; EDIT c3 = customer.cust_address, TITLE=%"label.cust_address"; END
LAYOUT STACK TABLE t1(UNMOVABLECOLUMNS) EDIT customer.cust_id, TITLE=%"label.cust_id"; EDIT customer.cust_name, TITLE=%"label.cust_name"; EDIT customer.cust_address, TITLE=%"label.cust_address"; END END END
LAYOUT TABLE { [c1 |c2 ] [ | ] [ | ] } END END ATTRIBUTES EDIT c1=FORMONLY.key; TEXTEDIT c2=FORMONLY.thetext; END ...
In the above example, the second column is defined as a TEXTEDIT item type, that can get a height as a number of grid cells. The height is defined by the number of item tags of the table row in the layout section (height=3 in our example)