©
serviceprofessionalgmbh
Who hasn't heard of this problem ? You need a wee panel to display a user remark in a hurry. No big deal, but:
All this in a single program ? Yes! The only problem with it: the window parameter of the panel does not allow any
variables for definition of width and height. To work around this problem we (unfortunately) had to
define 6 panels of different sizes of which the program selects the appropriate one depending of the message to be displayed.
In theory, it would also be possible to create the panel by the program at run time, but that would be at the expense of
performance. A second reason not to do so is because many poeple cannot cope with finding a panel (see PANELID ON) in the
panel concatenation after the end of the dialog.
Aufrufbeispiel:
puwinm#i = "Panel-Tilel" ,
"|[" ,
"|[Möchten Sie fortfahren?" ,
"|[" ,
"|Eingabeø ](J/N)"
address ispexec "vput puwinm#i"
call msgwin$e "AUTO"
address ispexec "vget (puwinm#o pulstrc)"
if pulstrc > 0 then return
parse var puwinm#o . "ø" antwort "]"
Das Programm
/* REXX * MSGWIN$E ****************************************************
* *
* Funktion: Window fuer wahrfreie Meldungsausgabe *
* RC 0 ==> Verlassen des Panels mit ENTER *
* RC 8 ==> Verlassen des Panels mit END *
* Texteingabe PUWINM#I aus SHARED-Pool *
* Textausgabe PUWINM#O in SHARED-Pool falls ENTER *
* *
**********************************************************************/
parse source . PGMTYP .
if PGMTYP = "FUNCTION" then arg CSR_POS,ZEILE,SPALTE,DUMMY
else arg CSR_POS ZEILE SPALTE DUMMY
address ispexec
"control errors return"
"vget (PUWINM#I)"
call parse_message
call set_panel_parms
call center_high
call set_msgdata
if CSR_POS = "AUTO" then CSR_POS = pos("ø",MSGDATA) + 1
if CSR_POS < 1 ! CSR_POS > MAXC then CSR_POS = 1
"addpop row("ZEILE") column("SPALTE")"
"display panel(&PANEL) cursor(msgdata) csrpos("CSR_POS")"
PULSTRC = RC
PUAKTRC = RC
"rempop"
drop MSGTITLE ZWINTTL
if pos("ø",MSGDATA) > 0 & PULSTRC = 0 then do
PUWINM#O = MSGDATA
"vput (PUWINM#O)"
end
else "verase (PUWINM#O)"
"vput (PULSTRC PUAKTRC)"
return PULSTRC
parse_message:
/******************************************************************
* Erzeugen der Meldungszeilen. Separator ist "|" *
******************************************************************/
drop W.
MAX_B = 0
MAX_H = 0
P = pos("|",PUWINM#I)
parse var PUWINM#I MSGTITLE "|" MSG
do I = 1 while strip(MSG) <> ""
MAX_H = MAX_H + 1
parse var MSG W.I "|" MSG
if length(W.I) > MAX_B then MAX_B = length(W.I)
end
return
center_high:
/******************************************************************
* Zentriert hoch, wenn mehr als eine Zeile nach unten uebrig *
******************************************************************/
TMP = H - MAX_H
if TMP < 2 then return
do I = 1 while W.I <> "W."I
TEMP.I = W.I
end
CNT = TMP % 2
do I = 1 to CNT
W.I = "["
end
do I = 1 while TEMP.I <> "TEMP."I
CNT = CNT + 1
W.CNT = TEMP.I
end
MAX_H = CNT
return
set_msgdata:
/******************************************************************
* Concatiniert den Meldungs-String (Dynamic AREA) *
******************************************************************/
MSGDATA = ""
do LINES = 1 to MAX_H
MSGDATA = MSGDATA !! center(W.LINES,B)
end
return
set_panel_parms:
/******************************************************************
* Variablen dynamische Panelansteuerung *
******************************************************************/
NAMES = "MSG1D MSG2D MSG3D MSG4D MSG5D MSG6D"
BREIT = "35 40 50 60 65 75"
HOCH = "5 8 10 12 15 22"
ZPOS = "8 7 6 5 3 1"
SPOS = "20 15 9 5 3 0"
MPOS = "185 320 500 720 975 1716"
do I = 1 to words(BREIT)
B = word(BREIT,I)
if MAX_B-1 <= B then do
leave
end
end
do I = 1 to words(HOCH)
H = word(HOCH,I)
if MAX_H <= H then do
leave
end
end
interpret "P = max("wordpos(B,BREIT)","wordpos(H,HOCH)")"
if datatype(ZEILE,"W") = 0 then ZEILE = word(ZPOS,P)
if datatype(SPALTE,"W") = 0 then SPALTE = word(SPOS,P)
B = word(BREIT,P)
H = word(HOCH,P)
PANEL = word(NAMES,P)
MAXC = word(MPOS,P)
return
Die Panels
)ATTR default($+_)
# area(dynamic) extend(on)
] type(dataout) intens(low) caps(off) color(white)
[ type(dataout) intens(low) caps(off) color(blue)
} type(dataout) intens(low) caps(off) color(yellow)
{ type(dataout) intens(low) caps(off) color(red)
~ type(dataout) intens(low) caps(off) color(red) hilite(reverse)
õ type(dataout) intens(low) caps(off) color(turq)
\ type(dataout) intens(low) caps(off) color(green)
^ type(dataout) intens(low) caps(off) color(pink)
ø type(datain) intens(low) caps(on)
)BODY window(35,5) /* MSG1D
)BODY window(40,8) /* MSG2D
)BODY window(50,10) /* MSG3D
)BODY window(60,12) /* MSG4D
)BODY window(65,15) /* MSG5D
)BODY window(75,22) /* MSG6D
#msgdata #
)INIT
if (&msgtitle = &z)
&zwinttl = &z
else
&zwinttl= &msgtitle
)END
back to REXX with ISPF