Switch frames, keep frame"state".....

Doug Johnson

New Member
[Windows XP - Progress 91E]

Is there a way to switch between two different frames/programs and preserve the "state" of each so when the user returns to the previous frame, everything is as it was before leaving? In the example below, I would want the input to NOT copy over to the main program from the called program. We want the user to be able to "jump" out from what they are doing, look up some info in a different program and then return to exactly what they were doing without interruption. I thought it would be as easy as just hiding frames, but it doesn't seem to work that way.

PROGRAM 1:
Code:
DEFINE VARIABLE x AS CHARACTER FORMAT "X(1)".
 
FORM "Scanning Menu1" AT 4.5 SKIP
     "PROG1" AT 9 SKIP
     "1. ONE" AT 6 SKIP
     "2. TWO" AT 6 SKIP
     "3. THREE" AT 6 SKIP
     "Enter Choice" AT 4 
     x AT 17
     WITH NO-BOX NO-LABELS NO-UNDERLINE ROW 1 FRAME setupa WITH BGCOLOR 8 SIZE 20 BY 8.

REPEAT:
    HIDE ALL.
    CLEAR ALL.

    DISPLAY WITH FRAME setupa.
    UPDATE x GO-ON(F5 F4 ESC) WITH FRAME setupa.

    IF LASTKEY=KEYCODE("F5") THEN DO:
        RUN I:\ITDATA\progress\Doug\outin2.p.
    END.

    IF LASTKEY=KEYCODE("F4") THEN LEAVE.
    IF LASTKEY=KEYCODE("ESC") THEN LEAVE.

    IF X = "1" THEN DISPLAY "ONE".
    IF X = "2" THEN DISPLAY "TWO".
    IF X = "3" THEN DISPLAY "THREE".
END.
PROGRAM 2
Code:
DEFINE VARIABLE y AS CHARACTER FORMAT "X(1)".

FORM "Scanning Menu2" AT 4.5 SKIP
     "PROG2" AT 9 SKIP
     "4. FOUR" AT 6 SKIP
     "5. FIVE" AT 6 SKIP
     "6. SIX" AT 6 SKIP
     "Enter Choice" AT 4 
     y AT 17
     WITH NO-BOX NO-LABELS NO-UNDERLINE ROW 1 FRAME setupb WITH BGCOLOR 8 SIZE 20 BY 8.

REPEAT:
    HIDE ALL.
    CLEAR ALL.

    DISPLAY WITH FRAME setupb.
    UPDATE Y GO-ON(F4 ESC F5) WITH FRAME setupb.
    
    IF LASTKEY=KEYCODE("F4") THEN LEAVE.
    IF LASTKEY=KEYCODE("ESC") THEN LEAVE.

    IF y = "4" THEN DISPLAY "FOUR".
    IF y = "5" THEN DISPLAY "FIVE".
    IF y = "6" THEN DISPLAY "SIX".
END.
 

rzr

Member
Not fully sure what you are trying to achieve....but maybe this will help you:

PROGRAM-1:
Code:
[FONT=courier new]DEFINE VARIABLE x AS INTEGER FORMAT "z".
 
DEFINE BUTTON BtnExit LABEL "Exit".[/FONT]
[FONT=courier new]DEFINE FRAME a.[/FONT]
[FONT=courier new]FORM "Scanning Menu1" AT 4.5 SKIP
     "PROG1" AT 9 SKIP
     "1. ONE" AT 6 SKIP
     "2. TWO" AT 6 SKIP
     "3. THREE" AT 6 SKIP
     "Enter Choice" AT 4 
     x AT 17 BtnExit AT 50
     WITH NO-BOX NO-LABELS NO-UNDERLINE ROW 1 FRAME setupa WITH BGCOLOR 8 .[/FONT]
[FONT=courier new]ON 'LEAVE':U OF X IN FRAME setupa
DO:
    ASSIGN X.
    CASE X:
        WHEN 1 THEN DISPLAY "ONE" WITH FRAME a.
        WHEN 2 THEN DISPLAY "TWO" WITH FRAME a.
        WHEN 3 THEN DISPLAY "THREE" WITH FRAME a.
    END CASE.
END.[/FONT]
[FONT=courier new]ON 'CHOOSE':U OF BtnExit
DO:
    APPLY "CLOSE" TO THIS-PROCEDURE.
END.[/FONT]
[FONT=courier new]ON 'F5':U OF FRAME setupa ANYWHERE 
DO:
    HIDE FRAME a.
    RUN PROGRAM-2.p.
    VIEW FRAME a.
END.[/FONT]
[FONT=courier new]ENABLE X BtnExit WITH FRAME setupa.
WAIT-FOR "CLOSE" OF THIS-PROCEDURE.[/FONT]

PROGRAM-2:

Code:
[FONT=courier new]DEFINE VARIABLE y AS INTEGER FORMAT "z".[/FONT]
[FONT=courier new]DEFINE BUTTON BtnExit LABEL "Exit".[/FONT]
[FONT=courier new]DEFINE FRAME a.[/FONT]
[FONT=courier new]FORM "Scanning Menu2" AT 4.5 SKIP
     "PROG2" AT 9 SKIP
     "4. FOUR" AT 6 SKIP
     "5. FIVE" AT 6 SKIP
     "6. SIX" AT 6 SKIP
     "Enter Choice" AT 4 
     y AT 17 BtnExit AT 50
     WITH NO-BOX NO-LABELS NO-UNDERLINE ROW 1 FRAME setupb WITH BGCOLOR 8 .[/FONT]
[FONT=courier new]ON 'LEAVE':U OF y IN FRAME setupb
DO:
    ASSIGN y.
    CASE y:
        WHEN 4 THEN DISPLAY "FOUR" WITH FRAME a.
        WHEN 5 THEN DISPLAY "FIVE" WITH FRAME a.
        WHEN 6 THEN DISPLAY "SIX" WITH FRAME a.
    END CASE.
END.[/FONT]
[FONT=courier new]ON 'CHOOSE':U OF BtnExit
DO:
    APPLY "CLOSE" TO THIS-PROCEDURE.
END.[/FONT]
[FONT=courier new]ENABLE y BtnExit WITH FRAME setupb.
WAIT-FOR "CLOSE" OF THIS-PROCEDURE.
HIDE FRAME a.[/FONT]
 
Top