Progress
Programming
Handbook


Multiple Active Frames

You can enable input for several frames simultaneously. In a graphical environment, the user can move among the active frames with the mouse—selecting any enabled field in a frame makes that the current frame.

In a character or graphical interface, the user can move to the next or previous frame with the NEXTFRAME and PREVFRAME keys. However, this moves focus between root frames parented by the same window, not between child frames in the same frame family.

You can adjust the spacing between frames in a window by setting the FRAME–SPACING attribute of the SESSION system handle. Its value specifies the number of display units between frames (pixels in graphical interfaces and character cells in character interfaces). By default, the value of FRAME–SPACING is the height of one row in the default system font.

The following procedure uses two frames to update the customer and salesrep records. They are spaced according to the default value for FRAME–SPACING:

p-frm18.p
FORM
  customer
  WITH FRAME cust-frame TITLE "Customer".
  
FORM
  salesrep WITH FRAME rep-frame TITLE "Salesrep".
  
ON LEAVE, GO OF customer.cust-num
   DO:
      FIND customer USING customer.cust-num.
      FIND salesrep OF customer.
      DISPLAY customer WITH FRAME cust-frame.
      DISPLAY salesrep WITH FRAME rep-frame.
      
      ENABLE ALL WITH FRAME rep-frame.
      DISABLE customer.cust-num WITH FRAME cust-frame.
   END. 
ON GO OF FRAME cust-frame, FRAME rep-frame
   DO:
      IF FOCUS <> customer.cust-num:HANDLE IN FRAME cust-frame
      THEN DO:      
         ASSIGN customer.
         ASSIGN salesrep.
         RUN reset-frames.
      END.
   END.
ON END-ERROR OF FRAME cust-frame, FRAME rep-frame
   DO:
      IF FOCUS <> customer.cust-num:HANDLE IN FRAME cust-frame
      THEN DO: 
         RUN reset-frames.
         RETURN NO-APPLY.
      END.
   END.
  
ENABLE ALL WITH FRAME cust-frame.

WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.

PROCEDURE reset-frames:
  CLEAR FRAME cust-frame.
  CLEAR FRAME rep-frame.
  DISABLE ALL WITH FRAME rep-frame. 
  ENABLE ALL WITH FRAME cust-frame.
  APPLY "ENTRY" TO customer.cust-num IN FRAME cust-frame.
END PROCEDURE. 

The procedure initially prompts for a customer number. It then displays the customer record in frame cust–frame and the associated salesrep record in frame rep–frame. Fields in both frames are enabled for input. The cursor is initially placed in the cust–frame frame, but you can move to rep–frame to modify the salesrep information. Note that the ASSIGN statements within the GO trigger are necessary to preserve any changes you make to either record.


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