Winforms and Event-driven Processing

In this section:

Maintain introduces a new graphical environment for displaying and editing data, and a new paradigm for developing applications. At the heart of both of these features are Winforms. This is a sample Winform:

Winforms are windows that you can use to display, enter, and edit data. You can also use Winforms to present choices to users and to control the flow of your application. For those familiar with MODIFY, this is similar to the role that CRTFORMs and Dialogue Manager Windows play in a MODIFY application, but Winforms go far beyond them. Winforms offer the following features to the Maintain developer:

The following sections introduce you to using Winforms and creating event-driven applications. Winforms, and the Winform Painter used to design and create them, are described in greater detail in Using the Winform Painter.


Top of page

x
How to Use Winforms

Winforms are Graphical User Interface (GUI) windows, similar to the windows used in Microsoft Windows. Winforms have standard window features, such as:

You can display multiple Winforms on the screen. One Winform can be active at a time—for example, to receive data from the keyboard—and you can transfer control from one Winform to another.


Top of page

x
Designing a Winform

When you design a Winform, you can set a number of properties, including:

Winforms offer a diverse set of ways by which an end user can select options, invoke procedures, display and edit fields, and get helpful information. For example, if you want the user to select an option or procedure, you can use any of the following controls (controls are referred to as objects in the Winform Painter):

If you wish to display or edit data, you can do so for:

You can provide the end user with helpful information by:


Top of page

x
Using Winforms in Block Mode

Mainframe monitors—whether they are actual terminals or personal computers emulating terminals—communicate with the host computer in block mode. Each time the user presses Enter or a function key, all of the information on the screen is sent, as a single block, to the host for processing. For example, if the user tabs to a new position on the screen and then types data into three fields, the host does not become aware of these actions until the user presses Enter or a function key.

This has important implications for using Winforms: to perform any action that requires selecting an item on the screen, you must position the cursor on the item—such as a pull-down menu—and then press Enter or a function key.

To perform an action that is triggered by a function key, simply press the key. If the action depends upon the screen context, first position the cursor on the appropriate item, and then press the function key. For example, in the Winform Painter the PF5 key moves a control. If the cursor is in an empty spot on the screen, pressing PF5 does not accomplish anything. If the cursor is on a grid, PF5 moves the grid; if the cursor is on a field, PF5 moves the field.


Top of page

x
Adjusting Winforms for Your Terminal Configuration

Different terminals and terminal emulators process screen information in different ways. Some configurations support dashed lines instead of solid Winform borders. For solid borders, SBORDER must be set to ON in your FOCUS session. (See the Developing Applications manual for information about SET commands.)

If a Winform's visual elements—such as check boxes and vertical scroll bars—are displayed incorrectly on the screen, you can adjust the Winform facility's terminal emulator setting. To do so for:

For more information, see Terminal.


Top of page

x
Optimizing Winform Performance

You can optimize Winform performance by deploying all Winforms in a single Maintain procedure.


Top of page

x
Designing Event-driven Applications

The flow of control in conventional processing is mostly pre-determined—that is, the programmer determines the few paths which the user will be able to take through the procedure.

To make your application more responsive to the user—using the graphical user interface—Maintain provides triggers and event-driven processing. A trigger is an action that is invoked—triggered—by a specified event. Each time that the event occurs, the trigger action (also known as an event handler) is invoked. In Maintain, the trigger action is a function or system action, and the event is something the user does in a Winform. For example, you might create a data retrieval trigger that notices whenever a user clicks a certain button on a Winform, and reacts by invoking a function that reads a data source and displays the data in the Winform.


Top of page

x
Creating Event-driven Applications

Developing a request by writing out sequential lines of code may be sufficient for conventional linear processing, but event-driven processing demands event-driven development. Developing an application in this way enables you to build much of the application's logic around the user interface. In effect, you paint the application as you paint the interface in the Winform Painter. For example, you could start by developing a Winform, then assigning a trigger to a particular Winform event, specifying the action (that is, the function) associated with the trigger, and finally coding the function.


Information Builders