Release 10.1A: OpenEdge Development:
Progress 4GL Handbook

> ## Using multiple windows

> As you’ve already learned, there is no `DEFINE WINDOW` statement in Progress. Any windows you build for your application are dynamic windows. This section summarizes some of the window handles and attributes that can be useful to you in designing an application with multiple windows.

> You create a window with the `CREATE WINDOW` statement, which has the same syntax as every other `CREATE` statement you’ve seen.

> ##### Window system handles

> The simple examples in this book that don’t use a window you create (or that is created for you in code the AppBuilder generates) use the default window that is part of every session. This has a system handle called `DEFAULT-WINDOW`. This handle is not something you would ordinarily use in a real application.

> You’ve seen the `CURRENT-WINDOW` system handle, which holds the handle of the window used by default for parenting frames, dialog boxes, and message alert boxes. The `CURRENT-WINDOW` attribute of a procedure overrides `CURRENT-WINDOW` for the context of that procedure only, without changing the value of the session-wide system handle. The statements in the standard AppBuilder window template that set both `CURRENT-WINDOW` and the `CURRENT-WINDOW` procedure attribute to the procedure’s window provide a good default for parenting of objects created and used in that procedure.

> Another useful system handle is `ACTIVE-WINDOW`, which holds the handle of the window that has received the most recent input focus in the application. This handle can help you assure that a dialog box or message alert box appears parented to the window where the user is currently working, even if it is not the current window of the procedure that executes the code to display the dialog box or message.

> ##### Useful window attributes, methods, and events

> Table 18–1 describes the numerous attributes, methods, and events that you can use to control the appearance and behavior of windows in your application.

> Table 18–1: Window attributes, methods, and events
> Type | Name | Description
> --- | --- | ---
> Attribute | `TITLE` | Specifies the window title.
> `HEIGHT-CHARS WIDTH-CHARS HEIGHT-PIXELS WIDTH-PIXELS` | Specifies the standard height and width of the window.
> `MIN-HEIGHT-CHARS MIN-WIDTH-CHARS MIN-HEIGHT-PIXELS MIN-WIDTH-PIXELS` | Specifies the minimum height and width of the window.
> `MAX-HEIGHT-CHARS MAX-WIDTH-CHARS MAX-HEIGHT-PIXELS MAX-WIDTH-PIXELS` | Specifies the maximum height and width of the window.
> `VIRTUAL-HEIGHT-CHARS` `VIRTUAL-WIDTH-CHARS VIRTUAL-HEIGHT-PIXELS VIRTUAL-WIDTH-PIXELS` | Specifies the maximum display area of the window.
> `MESSAGE-AREA MESSAGE-AREA-FONT` | Defines a message area and its font at the bottom of the window, where messages that are not qualified with the `VIEW-AS ALERT-BOX` phrase are displayed.
> `STATUS-AREA` `STATUS-AREA-FONT` | Defines a status area and its font at the bottom of the window.
> `SCROLL-BARS` | Defines whether scroll bars appear when the window is resized.
> `MENUBAR` `POPUP-MENU` | Associates a menu or pop-up menu with a window.
> `PARENT` | Establishes parent-child relationships between windows.
> Method | `LOAD-ICON()` | Takes the name of an image file with the`.ico` extension and displays the image in the title bar of the window, in the task bar when the window is minimized, and when the user selects the window using ALT+TAB.
> `LOAD-SMALL-ICON()` | Takes the name of an image file for an icon in the title bar or the task bar. The `.ico` file for either method can be an image of 16x16 or 32x32 pixels.
> Event | `WINDOW-MINIMIZED` | Fires when a window is minimized.
> `WINDOW-MAXIMIZED` | Fires when a window is maximized.
> `WINDOW-RESTORED` | Fires when a window is restored after being minimized.
> `WINDOW-RESIZED` | Fires when a keyboard or mouse event starts to change the window’s size. The window’s `RESIZE` attribute must be true for this to occur.
> `WINDOW-CLOSE` | Fires when the user selects the standard icon used to close the window. In fact, Progress does not take any action automatically when the `WINDOW-CLOSE` event occurs—it does not even close the window! For this reason, you need to define a trigger for the `WINDOW-CLOSE` event, as described in the next section.

> ##### WINDOW-CLOSE event example

> The simplest example of an action on the `WINDOW-CLOSE` event is this:

>     WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.

> If the `WAIT-FOR` statement is the last executable statement in a nonpersistent procedure, the event satisfies the `WAIT-FOR` and the procedure terminates.

> The AppBuilder window template uses indirection to direct the `WINDOW-CLOSE` event for the window to the procedure itself, using this standard `ON WINDOW-CLOSE` trigger:

>     DO:
>       /* This event will close the window and terminate the procedure.  */
>       APPLY "CLOSE":U TO THIS-PROCEDURE.
>       RETURN NO-APPLY.
>     END.

> You’ve already seen the rest of the steps in this sequence, with the `CLOSE` event on the procedure running `disable_UI` and deleting the procedure itself.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095