GDDM V3R2 Base Application Programming Guide
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF | BOOK


Locator input

GDDM V3R2 Base Application Programming Guide
SC33-0867-01



A locator logical input device provides the program with the (x,y) screen position, in world coordinates, of the graphics cursor. It can be triggered in the same ways as a pick device.

The call that queries locator input is GSQLOC, which returns one integer and two floating-point values:


     CALL GSQLOC(INWIN,X,Y);

GDDM sets the first parameter to indicate whether the locator was within the graphics window: 1 means it was inside, and 0, outside. (The graphics window, and the associated concept of the viewport, is described in "Hierarchy of GDDM concepts" in topic 7.0.) By default, the graphics window fills the screen, and so the cursor cannot be moved off the screen. In simple applications, therefore, the locator is always within the window. The second and third parameters are the locator coordinates.

The following code enables a locator, obtains input from it, and draws a symbol at the position it returns. The code includes a call to the routine shown in Figure 60 in topic 11.2 to let the end user select the symbol.


     DECLARE SYMB_ARRAY(10) CHAR(1)
                      INITIAL('A','B','C','D','E','F','G','H','I','J');
     DECLARE SYMB_NUM FIXED BINARY(31);
     DECLARE (DEV,DEVID,INWIN) FIXED BINARY(31);
     DECLARE (X,Y) FLOAT DEC(6);

/* . */ /* . */

CALL MENU(SYMB_NUM); /* Let end user select a symbol */

/* . */ /* . */

CALL GSENAB(2,1,1); /* Enable locator. */ CALL GSREAD(1,DEV,DEVID); /* Transmit current page*/ /* and wait for input. */ CALL GSQLOC(INWIN,X,Y); /* Query locator input. */ CALL GSCHAR(X,Y,1,SYMB_ARRAY(SYMB_NUM));/* Draw char at (x,y) */

Instead of the graphics cursor, the locator can be echoed by a rubber band, rubber box, or a specified segment. More information is given in "Initializing logical input devices" in topic 11.10 and succeeding sections.

Go to the previous page Go to the next page



Copyright IBM Corporation 1990, 2012