Progress
Programming
Handbook


Using Frame Families

Child frames help to organize the display area of the parent frame. They can contain their own field-level widgets, and like any frame parented to a window, they can be referenced in frame I/O statements. Child frames can be viewed and hidden like field-level widgets and also participate in the tab order of the parent frame.

You can choose a default button or Cancel button from a child frame. If a child frame does not have the chosen button, invoking that button in the child frame will cause the first default or Cancel button found in the frame family (and in no special order) to be chosen.

You can also parent child frames to a dialog box, which can serve as a root frame for a frame family. However, child frames cannot be viewed as dialog boxes, themselves. For more information on dialog boxes, see Interface Design."

Child frames have some additional restrictions:

The following procedure (p-fof2.p) uses a frame family to organize a window for updating customer records. It displays the Update window shown previously in Figure 19–6 and Figure 19–7.

p-fof2.p
DEFINE QUERY custq FOR customer.
DEFINE VARIABLE cnt AS INTEGER.
DEFINE BUTTON bprev LABEL "<".
DEFINE BUTTON bnext LABEL ">".
DEFINE BUTTON bupdate LABEL "Update".
DEFINE BUTTON bcommit LABEL "Commit".
DEFINE FRAME cust-fr SKIP(.5)
    SPACE(8) customer.name customer.cust-num customer.sales-rep
    customer.comments AT COLUMN 6 ROW 13.5
    WITH SIDE-LABELS TITLE "Customer Data" KEEP-TAB-ORDER 
&IF "{&WINDOW-SYSTEM}" <> "TTY" &THEN 
        SIZE 80 BY 15.
&ELSE
        SIZE 80 BY 16.
&ENDIF
DEFINE FRAME cont-fr SKIP(.5)
    customer.address COLON 17 SKIP
    customer.address2 COLON 17 SKIP
    customer.city COLON 17 SKIP
    customer.state COLON 17 SKIP 
    customer.postal-code COLON 17 SKIP
    customer.country COLON 17 SKIP
    customer.contact COLON 17 SKIP 
    customer.phone COLON 17
    WITH SIDE-LABELS TITLE "Contact Informaion" 
        SIZE 40 BY 10 AT COLUMN 1 ROW 3.
DEFINE FRAME ctrl-fr SKIP(.12)
    SPACE(.5) bprev bnext bupdate bcommit
    WITH TITLE "Find and Update Customer"
&IF "{&WINDOW-SYSTEM}" <> "TTY" &THEN 
       SIZE 27.5 BY 2 AT COLUMN 46 ROW 10.5.
&ELSE
       SIZE 29 BY 3 AT COLUMN 45 ROW 10.
&ENDIF
DEFINE FRAME acct-fr SKIP(.5)
    customer.balance COLON 15 SKIP 
    customer.credit-limit COLON 15 SKIP
    customer.discount COLON 15 SKIP 
    customer.terms COLON 15    
    WITH SIDE-LABELS TITLE "Account Information" 
        SIZE 39.8 BY 6 AT COLUMN 41 ROW 3.

ON CHOOSE OF bnext IN FRAME ctrl-fr DO:
    GET NEXT custq.
    IF NOT AVAILABLE customer THEN GET FIRST custq.
    RUN display-proc IN THIS-PROCEDURE.
END. 
ON CHOOSE OF bupdate IN FRAME ctrl-fr DO:
    DISABLE ALL WITH FRAME ctrl-fr.
    ENABLE bcommit WITH FRAME ctrl-fr.
    ENABLE ALL EXCEPT customer.cust-num WITH FRAME cust-fr.
    ENABLE ALL WITH FRAME cont-fr.
    ENABLE ALL EXCEPT customer.balance WITH FRAME acct-fr.
END.

ON CHOOSE OF bcommit IN FRAME ctrl-fr DO:
    DISABLE ALL WITH FRAME cust-fr.
    DISABLE ALL WITH FRAME cont-fr.
    DISABLE ALL WITH FRAME acct-fr.
    ENABLE ALL WITH FRAME ctrl-fr.
    DISABLE bcommit WITH FRAME ctrl-fr.
    GET CURRENT custq EXCLUSIVE-LOCK.
    IF NOT CURRENT-CHANGED(customer) THEN DO:
        ASSIGN customer EXCEPT customer.cust-num customer.balance.
        RELEASE customer.
    END.
    ELSE DO:
        GET CURRENT custq NO-LOCK.
        RUN display-proc IN THIS-PROCEDURE.
        DO cnt = 1 TO 12: BELL. END.
        MESSAGE "Customer" customer.name SKIP
                "was changed by another user." SKIP
                "Please try again..." VIEW-AS ALERT-BOX.
    END.
END.

FRAME cont-fr:FRAME = FRAME cust-fr:HANDLE.
FRAME acct-fr:FRAME = FRAME cust-fr:HANDLE.
FRAME ctrl-fr:FRAME = FRAME cust-fr:HANDLE.

IF NOT SESSION:WINDOW-SYSTEM = "TTY"    THEN CURRENT-WINDOW:TITLE = "Update 
...".
OPEN QUERY custq PRESELECT EACH customer NO-LOCK BY customer.name.
GET FIRST custq.
RUN display-proc IN THIS-PROCEDURE.
ENABLE ALL WITH FRAME ctrl-fr.
DISABLE bcommit WITH FRAME ctrl-fr.

WAIT-FOR WINDOW-CLOSE OF FRAME cust-fr. 
PROCEDURE display-proc:
    DISPLAY 
        customer.name customer.cust-num customer.sales-rep
        customer.comments WITH FRAME cust-fr.
    DISPLAY
        customer.address customer.address2 customer.city customer.state 
        customer.postal-code customer.country customer.contact 
        customer.phone WITH FRAME cont-fr.
    DISPLAY 
        customer.balance customer.credit-limit
        customer.discount customer.terms WITH FRAME acct-fr.
END. 

Note how each frame is managed individually for input and output. Displaying frame cust–fr displays its child frames, but not their field values. Likewise, enabling the fields of cust–fr for input has no effect on the fields in cont–fr, acct–fr, or ctrl–fr. Each of these child frames must have their field-level widgets enabled and disabled individually.

When enabled, you can tab among all the field-level widgets in the cust–fr frame family. For more information on frame family layout and tabbing behavior, see the remaining sections of this chapter and Interface Design."


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