Here is the sample code I wrote:
Do Forever
"DISPLAY PANEL(panel1)" /* panel* are the panels to be displayed */
if rc = 0 then do
fvar= VALUE(C) /* C is a variable from the panel panel1*/
SELECT
WHEN strip(fvar) = 1 then do
RC = CP0100() /* CP0x00 are the functions to be called */
END
WHEN strip(fvar) = 2 then do
RC = CP0200()
END
END
WHEN strip(fvar) = 3 then do
exit 0
END
OTHERWISE
SAY 'Wrong!'
exit 0
END
END
end
exit 0
CP0100: /* This is the function cp0100 */
"DISPLAY PANEL(panel2)"
return 0
CP0200: /* This is the function cp0200 */
"DISPLAY PANEL(panel3)"
return 0
"DISPLAY PANEL(panel1)" /* panel* are the panels to be displayed */
if rc = 0 then do
fvar= VALUE(C) /* C is a variable from the panel panel1*/
SELECT
WHEN strip(fvar) = 1 then do
RC = CP0100() /* CP0x00 are the functions to be called */
END
WHEN strip(fvar) = 2 then do
RC = CP0200()
END
END
WHEN strip(fvar) = 3 then do
exit 0
END
OTHERWISE
SAY 'Wrong!'
exit 0
END
END
end
exit 0
CP0100: /* This is the function cp0100 */
"DISPLAY PANEL(panel2)"
return 0
CP0200: /* This is the function cp0200 */
"DISPLAY PANEL(panel3)"
return 0
Here is what panel1 is like:
Please select one of the following, then press ENTER
_ 1. Call cp0100
2. Call cp0200
3. EXIT
This code worked, but there are some problems.
1.I used a "DO FOREVER" statement for a infinite loop, but when i am in the panel "cp0000p", the only way to end this loop(quit this dialog) is enter '3' and exit it.
It seems that PF3 key can not end this loop, I think that's not good. How to solve this problem?
2.For example, in panel1 i filled in the input field '1' then press enter, the program call cp0100 and displays panel2. Then I press PF3, the programe go back to display panel1. What I hope is that the iuput field in panel1 should be blank. But the fact is that it still has '1' in it.
So the problem is the input field can not be refreshed when a panel is redisplayed.
I tried REFRESH(*) in the panel design, but it still doesn't work....How to solve this problem?
Thanks!!