SeeView Manual

SeeView Statements and Script Symbols
HP NonStop SeeView Manual526355-004
9-35
DISPLAY
Example
This example shows how you can use the DISPLAY statement:
Example:
?MENU matrix { will contain matrix of [ ] fields.
?MENU data { data accepted from matrix on screen.
?PROC ShowMatrix ( rows, cols, width )
{------------------------------------}
{ Proc builds a fields window matrix of "rows" x "cols"
{ elements, where each element is "width" characters
{ wide. Matrix functions are Init-f5, Delete-f6, Add-f7.
{-------------------------------------------------------}
PARM rows, cols, width:=3;
VAR row, #s, aw:=8;
DELETE matrix!;
FOR rows DO BEGIN { build rows of flds [ ][ ][ ]..
row := row+1; { 0 .. rows-1
#s := "";
FOR cols DO #s:=#s & "[" & #SPACES[ 1:width ] & "]";
#s:=#s & " =[" & #SPACES[ 1:aw ] & "]";
PUSH #s ONTO matrix;
END;
PUSH "*" ONTO matrix; { * marks end of matrix in cache
WINDOW matrix MENU "CALL Op(" & rows &","& cols & ")"
KEYS F5,F6,F7,F8
HEAD "Init-f5 Del-f6 Add-f7 Copy-f8"
CACHE FIRST UNTIL/*/ FIELDS(U) NOFRAME
SIZE (cols*(width+2)+4+aw);
?PROC Op ( rows, cols )
{---------------------}
{ Based on the function key perform operation.
{---------------------------------------------}
PARM rows, cols;
LINE #MENULINE,#MENUCOL;
IF #FKEY=5 THEN CALL init(rows,cols);
IF #FKEY=6 THEN DISPLAY CLEAR;
IF #FKEY=7 THEN CALL accept(rows,cols);
IF #FKEY=8 THEN CALL copy;
?PROC init;
{---------}
{ initialize matrix to values from 0 .. (rows*cols-1)
{---------------------------------------------------}
PARM rows, cols;
VAR i,v; { note i, v initially = -1
FOR rows DO BEGIN
FOR cols DO BEGIN { value "v" into field i
DISPLAY (v:=v+1) FIELD (i:=i+1) FOR 1;
END;
DISPLAY CLEAR FIELD (i:=i+1) FOR 1; { clr last fld
END;