Was this helpful?
Defining Topframe
The Edit a USER Frame Definition frame appears as shown in the following figure. You are now ready to define the properties of Topframe.
ABF places the values you entered in the Create a USER Frame pop-up in the fields of this frame.
Topframe is the Frame Name.
The Short Remark field is initially empty. You can enter a brief comment, such as: This is the top entry frame.
The Form Name field contains the name of the form to use with this frame. The default is the name of the frame. You can change this field.
The Source File field shows the default name of the file to contain the 4GL code for the frame. This is the name of the frame with the SQL file extension .osq. (The QUEL extension is .osl.) You can change it if you like.
The Return Type field specifies the data type of the value that the return statement in this frame returns to the calling frame. This can be none (the default), or any Ingres data type.
Use the Static field to specify whether this frame's data can be saved between calls to the frame (the default is no). See Creating a User-Specified Frame.
The remaining fields give creation and update information about the frame.
Build the Menu for Topframe
The user frame Topframe includes both a form and a menu.
To build the menu for Topframe
1. Choose the Edit operation. You enter the system text editor under the file name topframe.osq.
2. You can now enter the 4GL source code needed for the frame. Enter the 4GL code in The 4GL Code for Topframe section.
3. When you exit from the editor, you return to the Edit a USER Frame Definition frame.
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.
Create Constants
Topframe's menu operation names are set up as application constants.
To create these constants
1. From the Edit a USER Frame Definition frame, select End to exit to the Edit an Application frame.
2. Select the Globals operation to display the Create or Edit Global Components pop-up menu.
3. Highlight Constants and choose Select.
The Edit Application Constants frame is displayed.
4. Select Create to display the Create an Application Constant pop-up, shown in the following figure.
5. In the Name field, enter custom_opt.
6. In the Short Remark field, optionally enter a brief description, such as Customer menu option, Topframe.
7. In the Type field, enter char.
8. In the Value field, enter Customer. This is the menu name that appears on the menu line.
9. Select OK to create the constant.
10. The Edit Application Constants frame appears, displaying the new constant and its features in the table field.
11. Repeat this procedure for each of the remaining three application constants for this frame. Their values are:
Name
Type
Value
Short Remark
End_opt
char
End
End menu option, Topframe
New_opt
char
New
New menu option, Topframe
sales_opt
char
Sales
Sales menu option, Topframe
12. You have now created the application constants used in the Topframe menu. The Edit Application Constants frame displays the constants in its table field, as shown in the following figure. Select End to return to the Edit an Application frame.
For more information about creating application constants, see Building Applications.
Create a Global Variable
Topframe contains a global variable, arr_count. This variable is an index counter for the dynamic array used in another Sales Entry frame, NewOrder. Topframe initializes arr_count to a value of "0."
To create this global variable
1. Display the Edit an Application frame.
2. From the Edit an Application frame, select the Globals operation to display the Create or Edit Global Components pop-up menu.
3. Highlight Variables and choose Select.
4. You see the Edit Global Variables frame. Select Create to display the Create a Global Variable pop-up.
5. In the Name field, enter arr_count.
6. In the Type field, enter smallint. Use the ListChoices menu operation if you want to select from a pop-up menu of data types.
7. In the Nullable field, take the default yes.
8. In the Short Remark field, optionally enter a brief description, such as Order array index counter.
9. The frame appears as in the following figure. Select OK to create the variable.
10. The Edit Global Variables frame appears. The global variable arr_count is displayed in the table field. Select End to return to the Edit an Application frame.
Topframe is almost complete, but you still must define the form. The FormEdit menu operation of the Edit a USER Frame Definition frame gives you direct access to VIFRED so that you can define the form's layout.
To create the form
1. Move to the Edit a USER Frame Definition frame for Topframe.
2. Choose FormEdit. Because you have not changed the default name of the form, VIFRED begins editing Topframe. The VIFRED Creating a Form pop-up tells you that the form does not exist, and offers a menu of form types.
3. Choose the Blank operation from the submenu and use VIFRED operations to create a form similar to the following. The text on this frame is composed completely of trim elements.
You have created a menu frame with four elements, not the five that Topframe has when the application is complete.
4. Select End. Save your changes in VIFRED, which returns you to ABF.
For more information, see the description of VIFRED in the Character-based Querying and Reporting Tools User Guide.
Last modified date: 08/28/2024