Example: Form Specification File custform.per
This form specification file is used with the dispcust.4gl
program to display program variables to the user. This form uses a layout with a simple
GRID to define the display area.
File
custform.per:
01 SCHEMA custdemo
02
03 LAYOUT
04 GRID
05 {
06 Store #:[f01 ] Name:[f02 ]
07 Address:[f03 ]
08 [f04 ]
09 City:[f05 ]State:[f6]Zip:[f07 ]
10 Contact:[f08 ]
11 Phone:[f09 ]
12
13 }
14 END --grid
15 END -- layout
16
17 TABLES
18 customer
19 END
20
21 ATTRIBUTES
22 EDIT f01 = customer.store_num, REQUIRED;
23 EDIT f02 = customer.store_name, COMMENT="Customer name";
24 EDIT f03 = customer.addr;
25 EDIT f04 = customer.addr2;
26 EDIT f05 = customer.city;
27 EDIT f6 = customer.state;
28 EDIT f07 = customer.zip_code;
29 EDIT f08 = customer.contact_name;
30 EDIT f09 = customer.phone;
31 ENDNote:
- Line
01lists the database schema file from which the form field data types will be obtained. - Lines
03through15delimit theLAYOUTsection of the form. - Lines
04thru14delimit theGRIDarea, indicating what will be displayed to the user between the curly brackets on lines05and13. - Line
17TheTABLESstatement is required since the field descriptions reference the columns of the database table customer. - Within the grid area, the form fields have item tags linking them to descriptions in the
ATTRIBUTESsection, in lines20thru28. As an example,f01is the display area for a program variable having the same data type definition as thestore_numcolumn in thecustomertable of thecustdemodatabase. - Line
22All of the item-tags in the form layout section are listed in theATTRIBUTESsection. For example, the item-tagf01is listed as having an item-type ofEDIT. This field will be used for display only in this program, but the same form will be used for input in a later program. An additional attribute,REQUIRED, indicates that when this form is used for input, an entry in the fieldf01must be made. This prevents the user from trying to add a row with a NULLstore_numto thecustomertable, which would result in an error message from the database. - Line
23The second field is defined with the attributeCOMMENT, which specifies text to be displayed when this field gets the focus, or as a tooltip when the mouse goes over the field.