PRO pcursor, xp, yp, perror=err, kludge=kludge, _extra=_extra ;+ ; NAME: ; pcursor ; PURPOSE: ; Kludging the IDL CURSOR procedure ; CALLING SEQUENCE: ; pcursor, xp, yp [, /device, /normal, /data, /down] ; INPUTS: ; None ; OUTPUTS: ; xp, yp coordinates of spin-hair cursor ; !err = 1/2/4 when left/middle/right button is pushed ; perror !err value returned by CURSOR procedure ; kludge if !d.name eq 'TEK' a blank print statement is inserted ; after the call to cursor ; INCLUDE: @compile_opt.pro ; On error, return to caller ; COMMON BLOCKS: common save_pcursor, ginchars ; CALLS: ; IsWindowSystem ; PROCEDURE: ; >> the KLUDGE keyword is required only for EMUTEK at the moment. Without ; the extra print statement the first call to CURSOR will work, but ; all subsequent calls will make EMUTEK get stuck in GIN mode. The ; reason is unclear. ; ; >> When using a mouse to select a screen location, the mouse buttons ; should return 1,2 and 4 in the !ERR system variable for left, middle ; and right mouse button (if the mouse has only two buttons use 1 and 2). ; The keys 1,2,3 or a,b,c or A,B,C or CTRL-A,CTRL-B,CTRL-C can be used ; to mimick mouse action, provided the CURSOR procedure puts the ASCII ; decimal equivalent of the corresponding key in the !ERR variable. If ; you get funny characters on the screen and/or you have to press one or ; more keys to return to the IDL prompt, there may be problems with the ; type-ahead buffer (i.e. CURSOR puts more/less characters in the type ; ahead buffer than IDL reads out of it before continuing). Set ; DEVICE,gin_chars=6 and try again. ; ; X-windows (!d.name = 'X'): ; Should work without any problems ; HDS3200 terminal (!d.name = 'TEK'): ; The mouse button keys should be user defined as , ; and for left, middle and right button respectively (the ; corresponding keyboard strokes are CTRL A, CTRL B and CTRL D). ; The error codes returned when pushing a button are the decimal ; equivalent of the first character of the user definition, which ; for the settings given above results 1,2 and 4 for left, middle ; and right button respectively. The IDL CURSOR procedure places ; the user definition of the button in the type-ahead buffer ; (one character in this case). ; VT240 (!d.name = 'REGIS'): ; It worked the last time I tried ; MODIFICATION HISTORY: ; FEB-91, Paul Hick (ARC) ;- IF !d.name EQ !ThePrinter THEN RETURN IF !d.name EQ 'TEK' THEN IF n_elements(ginchars) EQ 0 THEN BEGIN ginchars = 6 device, gin_chars=ginchars ENDIF cursor, xp, yp, 3, _extra=_extra err = !err ; Get cursor location IF NOT IsWindowSystem() THEN BEGIN IF (where(err EQ [1,49,65,97,76,108]))[0] NE -1 THEN $ ; Left button proxies: [SOH,1,A,a,L,l] !err = 1 $ ELSE IF (where(err EQ [2,50,66,98,77,109]))[0] NE -1 THEN $ ; Middle button proxies: [STX,2,B,b,M,m] !err = 2 $ ELSE $ !err = 4 ENDIF IF keyword_set(kludge) AND !d.name EQ 'TEK' THEN print ; Kludge print statement for EMUTEK RETURN & END