We are now going to create a new screen form like:
DATABASE FORMONLY SCREEN { Your Name: [mx1] Your Age: [mx2] Your Street: [mx3] Your Country: [mx4] Your Phone Number:[mx5] } ATTRIBUTES mx1 = FORMONLY.name; mx2 = FORMONLY.age; mx3 = FORMONLY.street; mx4 = FORMONLY:country; mx5 = FORMONLY.phone;
The attributes define the fields and their characteristics in the screen form.
Compile this screen form with “fcompile -xml input.per”.
And now we must write our main program. Create a new file called “input.4gl”.
At the head of this file you must declare the variable each time otherwise you cannot use it!
MAIN DEFINE name CHAR(50), age CHAR(10), street CHAR(255), country CHAR(50), phone CHAR(12) OPEN Input WITH FORM “input” MENU “Navigation” COMMAND “Edit” CALL edit_forms() COMMAND “Exit” EXIT MENU END MENU DISPLAY BY NAME name, age, street, country, phone END MAIN FUNCTION edit_forms() INPUT BY NAME name, age, street, country, phone END INPUT END FUNCTION
In this lesson we learned a new command “CALL edit_forms()”.
This command calls our function “edit_forms” under the MAIN section.
Compile this program by using “4glpc input.4gl -o input.4ae”.
Now we have created a new form in which you can enter data and display it with DISPLAY BY NAME.