GDDM-GKS V1R1 Programming Guide and Reference
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF | BOOK


Primitives and segments

GDDM-GKS V1R1 Programming Guide and Reference
SC33-0334-00



The primitives for the program must be created within segments to make them pickable during pick input. The initial picture consists of three segments.

The first segment consists of a panel containing two items of furniture. The primitives for the desk and chair are output after pick identifiers are set for each item. The Set pick identifier (GSPKID) function designates the current pick identifier. In GKS, primitives are associated with the pick identifier that was current when they were created. When a primitive is picked during pick input, the unique pick identifier is returned along with the associated segment name. In this case, the segment name is the same for the desk and the chair, although the pick identifiers are different.


     Create the first segment
          CREATE SEGMENT (100)
     Set pick identifier for desk
          SET PICK IDENTIFIER (101)
     Set fill color to background color
          SET FILL AREA COLOR INDEX (0)
     Set fill style to solid
          SET FILL AREA INTERIOR STYLE (1)
     Output invisible fill area
          FILL AREA (5, xdray, ydray)
     Set line color to foreground
          SET POLYLINE COLOR INDEX (1)
     Output polyline with 5 points
          POLYLINE (5, xdray, ydray)
     Set text color
          SET TEXT COLOR INDEX (3)
     Output text identifier
          TEXT (78.5, 92.0, 'desk')
     Set pick identifier for chair
          SET PICK IDENTIFIER (102)
     Output invisible fill area
          FILL AREA (5, xchray3, ychray3)
     Output polyline with 9 points
          POLYLINE (9, xchray1, ychray1)
     Output polyline with 2 points
          POLYLINE (2, xchray2, ychray2)
     Output text identifier
          TEXT (86.0, 73.5, 'chair')
     Close first segment
          CLOSE SEGMENT

During pick input, the user moves a graphics cursor or cross-hair cursor over a part of the primitive to be picked and presses Enter. The cross-hair cursor must be over one of the points that defines the primitive for a valid pick to be registered. This program places congruent invisible fill areas (drawn in background color) behind the visible primitives. This makes it easier to pick a primitive, because the cross-hair cursor can be anywhere inside the perimeter of the fill area for a valid pick.

The second segment consists of a polyline connecting seven points.


     create second segment
          CREATE SEGMENT (200)
     set line color
          SET POLYLINE COLOR INDEX (2)
     output lines for room outline
          POLYLINE (7, xrray1, yrray1)
     close second segment
          CLOSE SEGMENT

The third segment consists of the menu of options for choice input.

This is what the screen looks like after the initial segments are generated:


   PICTURE 17          

Go to the previous page Go to the next page



Copyright IBM Corporation 1990, 2012