View previous topic :: View next topic
|
Author |
Message |
jackzhang75
Active User
Joined: 09 Jun 2014 Posts: 125 Location: US
|
|
|
|
Hi ,
I think i opened topic before but i can't find . I have to re-open this question.
Now i got the panel and i want to press F3 to exit the progrom , but now i press F3 it not exit the progrom but operation as you hit enter. I don't know why and how to correct this problem ?? Thanks
Code: |
MYARG=userid()
call WHO
name=result
ADDRESS ISPEXEC
PANELLIB='TTAT.TSP.TU14.DR'
"ISPEXEC LIBDEF ISPPLIB DATASET ID('"PANELLIB"')"
rc=4
DO FOREVER
"DISPLAY PANEL (PANEL)"
SELECT
WHEN option='1' THEN rc=REX2CA()
WHEN option='2' THEN rc=REX2CRP()
WHEN option='3' THEN rc=REX2DIF()
WHEN option='4' THEN rc=REX2FAST()
WHEN option='5' THEN rc=REX2JCLP()
WHEN option='6' THEN rc=REX2PKZ()
WHEN option='7' THEN rc=REX2SS()
WHEN option='R' THEN rc=REXRMAIN()
WHEN option='M' THEN rc=REXXMORE()
WHEN option='X' THEN LEAVE
OTHERWISE "SETMSG MSG(ISPP195)"
END
END
return rc |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Look at some of the code already on the forum. I'm sure you will find the answer.
A little clue, post the code
SAY RC
directly after your line
ISPEXEC DISPLAY PANEL(PANEL)
and see what happens when you
a) Press ENTER
b) Press PF3 |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
I think i opened topic before but i can't find . I have to re-open this question. |
from the forum home page, after the login
You can click on view your posts |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Quote: |
but now i press F3 it not exit the progrom but operation as you hit enter |
Got a language barrier here - I do not understand what you are saying.
Code: |
DISPLAY PANEL
DO WHILE RC = 0
do something
DISPLAY PANEL
END
IF RC <> 8 /* Not PF3 hit */
THEN do something
|
or
Code: |
DISPLAY PANEL
IF RC = 0
do some things
ELSE do other things
|
Use the model command instead of documentation. It documents the various return codes. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Also, please show us the effort that you have made prior to posting on the forum.
We are here to help, but NOT be used as a free training program. |
|
Back to top |
|
|
Paul Voyner
New User
Joined: 26 Nov 2012 Posts: 52 Location: UK
|
|
|
|
jackzhang75, you still don't seem to have grasped that PF3 causes a RC=8, so your code has to handle that condition. What you pasted at the top doesn't. Various contributors here have advised you what to do, so it's pointless re-posting the same query if you won't do as they suggest. |
|
Back to top |
|
|
jackzhang75
Active User
Joined: 09 Jun 2014 Posts: 125 Location: US
|
|
|
|
Thanks for everyone's answer!
With your help, i found where is the problem.
The reason is if use Do forever , when you press F3 , it won't work.
I need to use Do while R=0 and if RC<>8 , this works perfect !
Again , i want to thanks everyone for your help! |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
That's not true, I use that construct regularly:
Code: |
Do Forever
"ISPEXEC DISPLAY PANEL(mypanel)"
If rc > 0 Then Leave
If Strip(zcmd) = "some value" Then ...
End
Exit 0
|
|
|
Back to top |
|
|
chaoj
Active User
Joined: 03 Jun 2010 Posts: 103 Location: Dalian
|
|
|
|
F12 also will exit . if you use rc
you could also use &VPFK = .PFKEY in the panel definition
then check the VPFK 's value |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Just a side remark:
The "DO FOREVER" is only one method amongst others, it does not have to be.
This method works as well:
Code: |
DISPLAY PANEL
DO WHILE RC = 0
do something
DISPLAY PANEL
END |
|
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Remember that the P in PFK stands for programmable! Do not assume that PFK3 always means 'exit'. It can mean whatever the user has defined it to mean.
PFK3 as END is only a convention; it is not a rule.
It is the END command that causes the RC=8. The user could just as easily assign PFK1 to the END command, or type 'END' on the command line.
My advice to dialog developers is to use the return code and the ZVERB field to determine what action is to be performed when a PFK is struck. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
I agree with Don: you should _not_ check which key was actually pressed, but rather check the command verb itself. |
|
Back to top |
|
|
|