14. ABF Development Example : Creating a User-Specified Frame : Defining Topframe : Enter the 4GL Code for Topframe
 
Share this page                  
Enter the 4GL Code for Topframe
This is the 4GL code for Topframe.
To enter the code
1. Select Edit from the Edit a USER Frame Definition frame to open the file topframe.osq.
2. Enter this code:
initialize =
begin
    arr_count := 0;
    /* Global variable arr_count will */
    /* contain the number of elements in */
    /* the global array cust_array */
end
/* Use global constants for menu names */
 sales_opt =
begin
    callframe salerep;
end
 custom_opt =
begin
    callframe customer;
end
 new_opt =
begin
    callframe neworder;
end
 end_opt =
begin
    return;
end
This code specifies four operations, set up as global constants: Sales, Customer, New and End. Each operation except End contains a single callframe statement.
End causes the application to exit, because Topframe is not called from any other frame. End contains a return statement that returns you to the ABF Topframe.
The other menu items call frames in the application. You can specify the menu options in the source file even though you have not yet defined the frames. For example, Sales calls the frame Salerep.
This frame uses two types of global application components, a global variable and a set of application constants:
Application Constants
Note the format of the menu item names, for example, :sales_opt. These are application constants you set up using the Globals submenu. See Create Constants.
Global Variables
Arr_count is a global variable that acts as a counter for a dynamic array used by the NewOrder frame in this application. The initialize statement at the beginning of the file sets its value to 1. See Create a Global Variable.