Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REXX - how to capture the encoded values in my screen/panel

Status
Not open for further replies.

jonats

Technical User
Sep 3, 2008
18
PL
Hi,

I have defined a panel in my rexx program where users can encode values on certain rows,columns.

How do I capture/pull the encoded value in my variable list?

Thanks and Regards,
Jonathan

Shown below is my screen panel.


----------------- JONATS ----------------
MASTERMIND ==>

PLEASE GUESS MY 4-DIGIT NUMBER

1. YOU HAVE 10 CHANCES TO GUESS
2. SCORING : XY
WHERE X = NUMBER OF CORRECT DIGIT
IN CORRECT POSITION
Y = NUMBER OF CORRECT DIGIT
IN WRONG POSITION

PLS PUT YOUR GUESS BELOW: SCORE
1. !
2. !
3. !
4. !
5. !
6. !
7. !
8. !
9. !
10. 1234 40
--------------------------------------
 

Not much here to go on....

I would suggest using the panel area you have shown as a display-only area, and have the player enter the guess on the command line.


Frank Clarke
--Is it time for another Boston Tea Party?
 
Hi Frank,

Thanks, it works on the command line....Is there any parameter to validate the input; I only want to accept digits 0-9 and up to 4 digits only....

%PLS INPUT HERE ==>_JG / /+

Best Regards,
Jonathan
 
Only by making the command line a 4-character field; that's a bad idea.

I suggested the command line because I didn't want to complicate things, but you could define an input-only 4-character field on the panel, no?


Frank Clarke
--Is it time for another Boston Tea Party?
 
how do i make my command line a 4-character field? thanks
 
Try this panel and test REXX.
It might help you get started.

RxUsr



)ATTR
% TYPE(TEXT) INTENS(HIGH) SKIP(ON) COLOR(YELLOW)
@ TYPE(TEXT) INTENS(LOW) SKIP(ON) COLOR(GREEN)
$ TYPE(INPUT) INTENS(LOW) COLOR(GREEN)
+ TYPE(TEXT) INTENS(LOW) SKIP(ON) COLOR(TURQUOISE)
)BODY
+
%----------------- JONATS ----------------
+ MASTERMIND ==>$msg
+
+ PLEASE GUESS MY 4-DIGIT NUMBER
+
+ 1. YOU HAVE 10 CHANCES TO GUESS
+ 2. SCORING : XY
+ WHERE X = NUMBER OF CORRECT DIGIT
+ IN CORRECT POSITION
+ Y = NUMBER OF CORRECT DIGIT
+ IN WRONG POSITION
+
+ PLS PUT YOUR GUESS BELOW: SCORE
+ 1. $G1 + @&XY1 +
+ 2. $G2 + @&XY2 +
+ 3. $G3 + @&XY3 +
+ 4. $G4 + @&XY4 +
+ 5. $G5 + @&XY5 +
+ 6. $G6 + @&XY6 +
+ 7. $G7 + @&XY7 +
+ 8. $G8 + @&XY8 +
+ 9. $G9 + @&XY9 +
+ 10. $G10 + @&XY10 +
)INIT
&GX = 'msg'
If (&G1 = '????')
&GX = 'G1'
If (&G2 = '????')
&GX = 'G2'
If (&G3 = '????')
&GX = 'G3'
If (&G4 = '????')
&GX = 'G4'
If (&G5 = '????')
&GX = 'G5'
If (&G6 = '????')
&GX = 'G6'
If (&G7 = '????')
&GX = 'G7'
If (&G8 = '????')
&GX = 'G8'
If (&G9 = '????')
&GX = 'G9'
If (&G10 = '????')
&GX = 'G10'
.CURSOR = &GX
.Attr(.CURSOR) = 'TYPE(INPUT) COLOR (YELLOW)'
.Attr(G1) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G2) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G3) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G4) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G5) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G6) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G7) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G8) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G9) = 'TYPE(OUTPUT) COLOR (GREEN)'
.Attr(G10) = 'TYPE(OUTPUT) COLOR (GREEN)'
)REINIT
REFRESH(*)
)PROC
If (&GX = 'G1')
VER (&G1,PICT,'NNNN')
If (&GX = 'G2')
VER (&G2,PICT,'NNNN')
If (.CURSOR = 'G3')
VER (&G3,PICT,'NNNN')
If (.CURSOR = 'G4')
VER (&G4,PICT,'NNNN')
If (.CURSOR = 'G5')
VER (&G5,PICT,'NNNN')
If (.CURSOR = 'G6')
VER (&G6,PICT,'NNNN')
If (.CURSOR = 'G7')
VER (&G7,PICT,'NNNN')
If (.CURSOR = 'G8')
VER (&G8,PICT,'NNNN')
If (.CURSOR = 'G9')
VER (&G9,PICT,'NNNN')
If (.CURSOR = 'G10')
VER (&G10,PICT,'NNNN')
.CURSOR = &GX
.Attr(.CURSOR) = 'TYPE(INPUT) COLOR (YELLOW)'
)END

/* REXX ******************************************** */
/* Test MASTERMIND Panel */
/* ***************************************************** */
trace off
number = 1234
G. = ''
XY. = ''
msg = ''

DisplayPanel:
Do Until Msg <> ''
Do i = 10 to 1 by -1
If g.i <> '' then
Do
XY.i = CALCXY(G.i)
j = i + 1
If XY.i <> 40 then G.j = '????'
leave i
End
End
If G.1 = '' then G.1 = '????'

Do i = 1 to 10
z = value('G'||i,G.i)
z = value('XY'||i,XY.i)
End
"ISPEXEC DISPLAY PANEL(JONATS)"
Do i = 1 to 10
G.i = value('G'||i)
XY.i = value('XY'||i)
End
End
Exit 0

CALCXY:
IF G.i = number then
Do
msg = '>>> You did it <<<'
return 40
End
If i = 10 then msg = '>>> The number was' number
Return 22
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top