Progress
Programming
Handbook


Creating Window Families

By default, when you create a window, Progress parents that window transparently to the window system. In this way, windows are siblings of each other. You must manage these windows individually.

You can also parent a window (child window) to another window (parent window) by setting the child window’s PARENT attribute to the widget handle of the parent window. Windows that are parented by a window, which in turn is parented by the window system, form a window family. The window parented by the window system is the root window of the window family. Windows parented by any child window, in turn, form a child window family. A child window can only be parented by one window at a time.

Window Families vs. Individual Windows

Each window in a window family, by itself, 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 more information on window family properties, see the WINDOW Widget, HIDDEN Attribute, and VISIBLE Attribute reference entries in the Progress Language Reference .

Window Family Example

The following procedure creates a window family with three windows—a parent, child, and grandchild window. By choosing the buttons in the default window (Control Panel), you can visualize most of the properties described in the previous list.

p-wow1.p
DEFINE VARIABLE whandle1 AS HANDLE.
DEFINE VARIABLE whandle2 AS HANDLE.
DEFINE VARIABLE whandle3 AS HANDLE.
DEFINE BUTTON bviewp LABEL "VIEW".
DEFINE BUTTON bviewc LABEL "VIEW".
DEFINE BUTTON bviewgc LABEL "VIEW".
DEFINE BUTTON bhidep LABEL "HIDE".
DEFINE BUTTON bhidec LABEL "HIDE".
DEFINE BUTTON bhidegc LABEL "HIDE".
DEFINE BUTTON bhiddp LABEL "HIDDEN".
DEFINE BUTTON bhiddc LABEL "HIDDEN".
DEFINE BUTTON bhiddgc LABEL "HIDDEN".
DEFINE FRAME alpha SKIP
    "Parent" AT 11 "Child" AT 37 "Grand Child" AT 64 SKIP
    bviewp AT 11 bviewc AT 37 bviewgc AT 64 SKIP(.5)
    bhidep AT 11 bhidec AT 37 bhidegc AT 64 SKIP(.5)
    bhiddp AT 11 bhiddc AT 37 bhiddgc AT 64
WITH SIZE 80 BY 6.

CREATE WINDOW whandle1
    ASSIGN  TITLE = "Parent Window"
            HEIGHT-CHARS = 5
            WIDTH-CHARS = 27
            PARENT = CURRENT-WINDOW.
CREATE WINDOW whandle2
    ASSIGN  TITLE = "Child Window"
            HEIGHT-CHARS = 5
            WIDTH-CHARS = 27
            PARENT = whandle1.
CREATE WINDOW whandle3
    ASSIGN  TITLE = "Grand Child Window"
            HEIGHT-CHARS = 5
            WIDTH-CHARS = 27
            PARENT = whandle2.
                            
ON CHOOSE OF bviewp DO: /* View Parent */
    VIEW whandle1.
    RUN win-status IN THIS-PROCEDURE.
END. 
ON CHOOSE OF bhidep DO: /* Hide Parent */
    HIDE whandle1.
    RUN win-status IN THIS-PROCEDURE.
END.
ON CHOOSE OF bhiddp DO: /* Hidden Parent */
    whandle1:HIDDEN = TRUE.
    RUN win-status IN THIS-PROCEDURE.
END.
ON CHOOSE OF bviewc DO: /* View Child */
    VIEW whandle2.
    RUN win-status IN THIS-PROCEDURE.
END.
ON CHOOSE OF bhidec DO: /* Hide Child */
    HIDE whandle2.
    RUN win-status IN THIS-PROCEDURE.
END.
ON CHOOSE OF bhiddc DO: /* Hidden Child */
    whandle2:HIDDEN = TRUE.
    RUN win-status IN THIS-PROCEDURE.
END.
ON CHOOSE OF bviewgc DO: /* View Grand Child */
    VIEW whandle3.
    RUN win-status IN THIS-PROCEDURE.
END.
ON CHOOSE OF bhidegc DO: /* Hide Grand Child */
    HIDE whandle3.
    RUN win-status IN THIS-PROCEDURE.
END.
ON CHOOSE OF bhiddgc DO: /* Hidden Grand Child */
    whandle3:HIDDEN = TRUE.
    RUN win-status IN THIS-PROCEDURE.
END.

CURRENT-WINDOW:TITLE = "Control Panel".
CURRENT-WINDOW:HEIGHT-CHARS = 6.
ENABLE ALL IN WINDOW CURRENT-WINDOW WITH FRAME alpha.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
                     
PROCEDURE win-status:
    MESSAGE "Parent HIDDEN:" whandle1:HIDDEN 
            "/ Parent VISIBLE:" whandle1:VISIBLE
            "/ Child HIDDEN:" whandle2:HIDDEN 
            "/ Child VISIBLE:" whandle2:VISIBLE.
    MESSAGE "Grand Child HIDDEN:" whandle3:HIDDEN
            "/ Grand Child VISIBLE:" whandle3:VISIBLE.    
END. 

Figure 21–1 shows the Control Panel window and the example window family.

Figure 21–1: Window Family

Combine the VIEW, HIDE, and HIDDEN button events with the WINDOW–MINIMIZE and WINDOW–RESTORE events using the window controls to see how window hiding and viewing work together with window minimizing and restoring.

For an example that uses a window family in a database application, see the "Persistent Multi-window Management" section.


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