Progress
Language Tutorial
for Character
Using Multi-window Interfaces
The scope of this tutorial is to provide a basic, but thorough, understanding of the interface components and language statements needed to write single-window applications. Still, Progress supports a wide range of advanced programming options to let you create multi-window applications in graphical environments. For more information on these advanced techniques, see the Progress Programming Handbook for more information.
What follows in the next few sections is a quick introduction to very basic window concepts. The purpose is to contrast these concepts and techniques with those that apply to field-level widgets and windows.
Window Attributes
The design of multi-window applications is outside the scope of this tutorial, but the tutorial does show you how to create a second window. When working with windows, three attributes are important to know about:
- MENU-BAR — Use this WIDGET-HANDLE attribute to supply the widget handle of the menu bar that belongs to the window. "Building Menus," discusses menus and the menu-bar widget.
- MESSAGE-AREA — Use this LOGICAL attribute to specify whether you want a message area in your window.
- STATUS-AREA — Use this LOGICAL attribute to specify whether you want a status area in your window.
Creating a New Window
You can create a new window with the CREATE Widget statement. The window inherits the look and feel of the environment in which you create it. The CREATE Widget statement allows you to create windows dynamically within a program. This is the syntax for creating a window.
For the most part, you need to assign attributes to window widgets as you create them, as in the following example:
Referencing Windows
Progress defines a window widget as the workspace of your application. Each time you start a Progress session, it automatically creates a default window. In graphical environments, you start with the default window, but you can create other, overlapping windows dynamically within your application.
When you are working with the default window, you reference it by using the DEFAULT-WINDOW system handle. This system handle holds the widget handle of the default window.
When you are working with more than one window, the CURRENT-WINDOW system handle holds the widget handle of the window that has input focus. For single-window applications, DEFAULT-WINDOW and CURRENT-WINDOW are equal, but referring to DEFAULT-WINDOW is a little clearer.
When you have two or more windows, only the current window has input focus.
Finally, to clarify ambiguous references to widgets in different windows, use the IN WINDOW syntax. For example, an application may have several Delete buttons. The following code fragment uses the IN WINDOW syntax to specify the Delete button in the window, Mywindow:
Window Events
When you are working with windows, there are four event functions that you’ll frequently use to add functionality to the window.
- WINDOW-MINIMIZED — Occurs when the user iconifies (minimizes) a window.
- WINDOW-MAXIMIZED — Occurs when a user maximizes a window.
- WINDOW-RESTORED — Occurs when a window is restored from an icon state.
- WINDOW-CLOSE — Occurs when a user closes a window. WINDOW-CLOSE is frequently used as the condition of a WAIT-FOR statement.
Defining Window Families
When you design an application that uses multiple windows, you can create useful interactions between the windows by parenting windows to other windows. A group of windows that are parented to one another is called a window family. By defining a window family, you allow yourself the opportunity to manage the windows individually or as a group.
The window parented by the window system is the root window. A parent window is a window that parents another window, and a window parented by another window is a child window. Windows that are parented by the same window are sibling windows. A child window can only be parented by one window at a time.
Each window in a window family functions much the same as an individual window. That is, you can individually move, resize, and interact with a member of a window family like an individual window. However, window families share a number of additional properties that make them convenient for both applications and users to manage. For example, window families make it easier for you to coordinate:
- Viewing and hiding — When you view any member of a window family, all family members are viewed unless one or more of them have their HIDDEN attributes set to TRUE. Progress also hides all descendant windows that are minimized when you hide a parent.
- Minimizing and restoring — You can minimize and restore all members of a window family individually. When you minimize (iconify) a window, Progress hides all of its descendants. When you restore a parent window, Progress redisplays any hidden descendants.
- Close events — If a parent window receives a WINDOW-CLOSE event, it propagates a PARENT-WINDOW-CLOSE event to all of its descendant windows. However, you must write a trigger to execute an action on these events. This event does not propagate to sibling windows.
The relationships created by window families can be very useful because you can use them to manage your interface more effectively, and with less code. If you define a window family, you can control all the windows for an application as a single set, or as individual windows. For example, you can ensure that Progress closes all windows in an application when the user closes the root window. You can ensure that when a parent window is minimized, all the descendant windows of that window are also closed. This is useful in applications that use persistent procedures.
To define a window family, set the PARENT attribute of the child window to the widget handle of the parent window, as shown below. In
lt-12-04.p
, window child1 is a child window of window parent1, and window grandchild1 is a child window of window child1. You can use this example to investigate the minimizing properties of window families:
When you run
lt-12-04.p
, Progress displays the following screen:
;
For a discussion of windows and window programming techniques, see the Progress Programming Handbook .
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |