Tutorial Chapter 3: Displaying Data (Windows/Forms)
This chapter illustrates opening a window that contains a form to
display information to the user. An SQL statement is used to retrieve the data from a database
table. A form specification file is defined to display the values retrieved. The actions that are
available to the user are defined in the source code, tied to buttons that display on the
form.
Application Overview This example program opens a window containing a form to display information to the user.The .4gl File - Opening Windows and Forms A program creates a window with the OPEN WINDOW
instruction, and destroys a window with the CLOSE WINDOW
instruction.The .4gl File - Interacting with the User Your form can display options to the user using action views - buttons, dropdown menus (topmenus), toolbars, and other items on the window.The .4gl File - Retrieving and Displaying Data The example demonstrates how to define a record so you can treat variables as a group. Static SQL instructions retrieve rows from the database which are displayed to the form using the DISPLAY BY NAME
statement.Example: dispcust.4gl (function query_cust) This function retrieves a row from the customer
table and displays it in a form.The Form Specification File You can specify the layout of a form in a form specification file, which is compiled separately from your program. The form specification file defines the initial settings for the form, which can be changed programmatically at runtime.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.Compiling the Program and Form When this form is compiled (translated) using the Compile menu option in the Project view or the fglform tool, an XML file is generated that has a file extension of .42f . The runtime system uses this file along with your programs to define the Abstract User Interface.