When you first create a number of overlapping partitions, the viewing
order depends on the order in which you create the partitions. The
partition that you create first is at the bottom of the viewing order, and
the partition that you create last is at the top. On the display screen,
each partition appears on top of the partitions that are below it in the
viewing order. Some partitions may be hidden behind other partitions, or
may have their visibility attribute set to invisible, but they are still
present in the viewing order.
You can change the priority of some or all of the partitions in the
viewing order, using the call PTSSPP. This call lets you specify an array
of identifiers of partitions whose priorities are to be adjusted by
placing them as neighbors to one of the other partitions in the viewing
order.
For example, suppose a partition set has the following seven partitions in
descending order:
TOP 7, 6, 5, 4, 3, 2, 1 BOTTOM
If you wanted to take partitions 7, 2, and 1, and change their order of
viewing so that they are after partition 5 and before partition 4, like
this:
TOP 6, 5, 1, 7, 2, 4, 3 BOTTOM
you would issue the following call:
DCL PRI_ARRAY (3) FIXED BIN(31) INIT(2,7,1);
CALL PTSSPP(1,4,3,PRI_ARRAY); /* Change partition viewing order */
The parameters are as follows:
- The first parameter specifies whether the partitions in the array in
the final parameter are to be placed in descending or ascending order
from the reference partition. (The reference partition is the
reference point in the viewing order about which the reordering of the
partitions is to take place. It is specified in the second parameter.
In the example, it is partition 4.)
The first parameter can have these values:
- -1
- Descending order. The partitions in the array are placed behind
the reference partition.
- 1
- Ascending order (as in the example). The partitions in the array
are placed in front of the reference partition.
- The second parameter contains the identifier of the reference
partition relative to which the reordering is to take place. It can
have a value of -1, the effect of which depends on whether you set the
first parameter to ascending or descending order:
- Descending
- The first partition in the array becomes the top partition
in the viewing order, and the rest of the partitions in
the array are placed behind it.
- Ascending
- The first partition in the array becomes the bottom
partition in the viewing order, and the rest of the
partitions in the array are placed in front of it.
- The third parameter contains the number of elements in the array in
the final parameter
- The final parameter is an array of identifiers of partitions whose
priorities are to be adjusted relative to the reference partition.
Any element of the array can contain a value of -1, which causes all
further elements to be ignored.
The reordering process takes the first partition in the array and places
it above or below the reference partition in the viewing order, depending
on the order specified in the first parameter. It then takes the second
partition in the array and places it above or below the first partition,
and so on, until all the elements of the array parameter have been
processed, or until a value of -1 is found in the array.
The following programming example creates five overlapping partitions.
Each partition is filled with a shading pattern, and some alphanumerics.
The initial output displayed by the program is shown in Figure 127.
Initially, the cursor is displayed in partition 5. Partition 5 overlaps
partition 4, partition 4 overlaps partition 3, and so on. If the terminal
user moves the cursor into the visible part of, for example, partition 3,
and presses the ENTER key (or some other interrupt-generating key) the
program uses the PTSSPP call to bring that partition to the top of the
viewing order. If the user then moves the cursor into, for example,
partition 5, and presses the ENTER key, partition 3 is replaced behind
partition 2 and in front of partition 4, and partition 5 is brought to the
top. Pressing the PF12 key terminates the application.
FOLDERS: PROC OPTIONS(MAIN);
DCL PARMS(4) FIXED BIN(31) INIT (0,0,1,1);
DCL PARMS1(4) FIXED BIN(31) INIT (1,1,15,40);
DCL PRIORITY(5) FIXED BIN(31) INIT(5,4,3,2,1);
DCL (TYPE,MOD,COUNT) FIXED BIN(31);
DCL COLOR FIXED BIN(31) INIT(0);
DCL PATTERN FIXED BIN (31) INIT(0);
CALL FSINIT;
CALL PTSCRT(1,4,PARMS); /* Emulate partitions - they overlap */
CALL PTNCRT(1,4,PARMS1); /* Top left partition */
COLOR=1;
PATTERN=1;
CALL COLOR_FOLDER;
CALL ASCPUT(1,8,'Folder 1');
CALL ASCPUT(2,79,(79)'A');
PARMS1(1)=5;
PARMS1(2)=11;
CALL PTNCRT(2,4,PARMS1);
COLOR=2;
PATTERN=2;
CALL COLOR_FOLDER;
CALL ASCPUT(1,8,'Folder 2');
CALL ASCPUT(2,79,(79)'B');
PARMS1(1)=9;
PARMS1(2)=21;
CALL PTNCRT(3,4,PARMS1);
COLOR=3;
PATTERN=3;
CALL COLOR_FOLDER;
CALL ASCPUT(1,8,'Folder 3');
CALL ASCPUT(2,79,(79)'C');
PARMS1(1)=13;
PARMS1(2)=31;
CALL PTNCRT(4,4,PARMS1);
COLOR=4;
PATTERN=4;
CALL COLOR_FOLDER;
CALL ASCPUT(1,8,'Folder 4');
CALL ASCPUT(2,79,(79)'D');
PARMS1(1)=17;
PARMS1(2)=41;
CALL PTNCRT(5,4,PARMS1); /* Bottom right partition */
COLOR=5;
PATTERN=5;
CALL COLOR_FOLDER;
CALL ASCPUT(1,8,'Folder 5');
CALL ASCPUT(2,79,(79)'E');
DO I=1 TO 99;
CALL ASREAD(TYPE,MOD,COUNT);
CALL PTNQRY(1,1,PARMS);
IF MOD>11 THEN GOTO ENDIT;
CALL PTSSPP(-1,-1,5,PRIORITY); /* Restore original order */
CALL PTSSPP(-1,-1,1,PARMS); /* Put selected partition at top*/
END;
COLOR_FOLDER: PROC;
CALL ASDFLD(1,1,2,1,8,0);
CALL ASDFLD(2,3,2,2,39,0);
CALL GSSEG(0);
CALL GSCOL(COLOR);
CALL GSPAT(PATTERN);
CALL GSMOVE(0,0);
CALL GSAREA(1);
CALL GSLINE(0,100);
CALL GSLINE(100,100);
CALL GSLINE(100,0);
CALL GSLINE(0,0);
CALL GSENDA;
END COLOR_FOLDER;
ENDIT:;
CALL FSTERM;
%INCLUDE ADMUPINA;
%INCLUDE ADMUPINP;
%INCLUDE ADMUPINF;
%INCLUDE ADMUPING;
END FOLDERS;
Figure 126. Example of program with controlled viewing order of partitions
A display showing a five overlapping partitions each in a different
color and each with the title 'Folder' and a number from 1 to 5.
They are displayed in increasing order of priority with partition 5
at the front and partition 1 at the back.
Figure 127. Output from program with prioritized partition viewing
|