Form example: dispcust.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 dispcust.per:
1 SCHEMA custdemo
2
3 LAYOUT
4 GRID
5 {
6 Customer:[f1 ] Name:[f2 ]
7 Address:[f3 ]
8 City:[f4 ]State:[f5]Zip:[f6 ]
9 Contact:[f7 ]
10 Phone:[f8 ]
11 }
12 END
13 END
14
15 TABLES
16 customer
17 END
18
19 ATTRIBUTES
20 EDIT f1=customer.cust_num, NOENTRY;
21 EDIT f2=customer.cust_name, REQUIRED, NOT NULL, COMMENT="Customer name";
22 EDIT f3=customer.addr;
23 EDIT f4=customer.city;
24 EDIT f5=customer.state;
25 EDIT f6=customer.zipcode;
26 EDIT f7=customer.contact_name;
27 EDIT f8=customer.phone;
28 ENDNote:
- Line
1defines the database schema file from which the form field data types will be obtained. - Lines
3through13delimit theLAYOUTsection of the form where item tags are used. - Lines
4thru11delimit theGRIDarea, indicating what will be displayed to the user between the curly brackets. - Line
15: TheTABLESstatement 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. As an example,f1is the display area for a program variable having the same data type definition as thecust_numcolumn in thecustomertable of thecustdemodatabase. - Line
20: All of the item-tags in the form layout section are listed in theATTRIBUTESsection. For example, the item-tagf2is 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 fieldcust_namemust be made.NOT NULLprevents the user from trying to set an emptycust_name, which would result in an error message from the database. - Line
21: The 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.