Progress
Programming
Handbook


Non-persistent Multi-window Management

The following procedure creates a concurrent window and stores its handle in the new–win variable. It then preforms I/O to both the new window and the static window:

p-win1.p 
DEFINE VARIABLE new-win AS WIDGET-HANDLE.

FORM
   customer
   WITH FRAME cust-frame.
   
FORM
   salesrep
   WITH FRAME rep-frame.

CREATE WINDOW new-win
      ASSIGN TITLE = "Sales Representative".

ASSIGN DEFAULT-WINDOW:TITLE = "Customer".

VIEW new-win.
MESSAGE "This is the default window.".
MESSAGE "This is the newly created window." IN WINDOW new-win.

PAUSE 0 BEFORE-HIDE. 
FOR EACH customer, salesrep OF customer ON ERROR UNDO, LEAVE
       ON ENDKEY UNDO, LEAVE ON STOP UNDO, LEAVE:
   DISPLAY customer WITH FRAME cust-frame.
   ENABLE ALL WITH FRAME cust-frame. 
   
   CURRENT-WINDOW = new-win.
   DISPLAY salesrep WITH FRAME rep-frame.
   ENABLE ALL WITH FRAME rep-frame.
   CURRENT-WINDOW = DEFAULT-WINDOW. 
   
   WAIT-FOR GO OF FRAME cust-frame, FRAME rep-frame. 
   
   ASSIGN customer.
   ASSIGN salesrep. 
END.

DELETE WIDGET new-win. 

The p-win1.p procedure demonstrates two ways to direct I/O to a specific window: the IN WINDOW option and the CURRENT–WINDOW handle. Because the first MESSAGE statement does not reference a window, it writes to the current window, which is initially the static window for the session. The second message uses the IN WINDOW option to direct the output to the newly created window. Within the FOR EACH group, the first DISPLAY statement writes to the static window. Before the second DISPLAY statement, the CURRENT–WINDOW value is reset to the new window. Therefore, that DISPLAY statement writes to the new window. The value of CURRENT–WINDOW is then reset to the static window. Note that the DISPLAY statements must use separate frames, because a frame can only appear in one window at a time.


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