In article 2kcgiuINN1t4@i32.sma.ch, stl@sma.ch (Stephen Strebel) writes:
> Hello,
>
> does anyone know how to change the cursor in IDL to say, a hand, or
> anything? (I am running idl 3.5 on a sparc 10, SOlaris 1.0) I need
> this (currently) to build a panning/grabbing tool for images.
>
...>
> stephen Strebel
> --
Hi
The main idea is to use: DEVICE, CURSOR_STANDARD=x
(on my system x=58,...61 sets the cursor to different shapes of hands)
I've appended a short routine to display different cursors available.
karl
P.S.: Sorry for the "GOTO's"
____________________________________________________________ __________________
__ ____ __
/ // _ \ / / Karlheinz Knipp phone: +49 511 - 762 4922
/ // /_/ // / University of Hannover fax: +49 511 - 762 2483
/ // ____// / Institute for Photogrammetry
/ // / / / Nienburger Str.1
/_//_/ /_/ FRG 30167 Hannover 1 email: knipp@ipi.uni-hannover.de
vvvvvvvvvvvvvvvvvvvvv CUT HERE vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
;+
pro demo_x_cursor, l_0, l_1
; demonstrates different cursor-figures under X-Windows
; ------------------------------------------------------------ ------------------
; START OF DESCRIPTION
;
; subroutine IPI, U Hannover 09'91, modified 11'92
;
; METHOD: demonstrates different cursor-figures under X-Windows
;
; uses device, cursor_standard = l
; click left button: l = l + 1
; middle " : l = l - 1
; right " : QUIT
;
; INPUT PARAMETER: l_0, l_1 loop-indices [def.; 0, 30]
; OUTPUT PARAMETER: none
; KEYWORDS : none
;
; EXAMPLE:
;
; demo_x_cursor
;
; END OF DESCRIPTION
; ------------------------------------------------------------ ------------------
;-
; ------------------------------------------------------------ ------------------
; test input
if n_params() ne 0 and n_params() ne 2 then begin
print,"The number of parameters was wrong:",n_params()
doc_library,"demo_x_cursor"
return
endif
if n_params() eq 0 then begin
l_0 = 0
l_1 = 30
endif
d1 = l_0 < l_1
d2 = l_0 > l_1
l_0 = d1
l_1 = d2
window, /free, xsize=256,ysize=256
text1 = 'LB to continue RB to exit'
if !d.name ne 'X' then begin
xyouts, 32, 256-64, text1, font=0, /device
xyouts, 32, 256-128,'WARNING : device is NOT x but : '+!d.name, $
font=0, /device
cursor, x, y, /wait, /dev
wait, 0.125
if !err eq 4 then goto, FINITUM
endif
polyfill, [31, 95, 95, 32], [31, 31, 95, 95], color=!d.n_colors-1, /dev
polyfill, 128+[31, 95, 95, 32], [31, 31, 95, 95], color=get_grey(), /dev
; ------------------------------------------------------------ ------------------
; test input
device, /cursor_crosshair
tvcrs, 128,64, /dev
text2 = 'device, /cursor_crosshair'
xyouts, 32, 256-64, text1, font=0, /device
xyouts, 32, 256-128, text2, font=0, /device
cursor, x, y, /wait, /dev
wait, 0.125
if !err eq 4 then goto, FINITUM
erase
polyfill, [31, 95, 95, 32], [31, 31, 95, 95], color=!d.n_colors-1, /dev
polyfill, 128+[31, 95, 95, 32], [31, 31, 95, 95], color=get_grey(), /dev
device, /cursor_original
tvcrs, 128,64, /dev
text2 = 'device, /cursor_orignal'
xyouts, 32, 256-64, text1, font=0, /device
xyouts, 32, 256-128, text2, font=0, /device
cursor, x, y, /wait, /dev
wait, 0.125
if !err eq 4 then goto, FINITUM
erase
polyfill, [31, 95, 95, 32], [31, 31, 95, 95], color=!d.n_colors-1, /dev
polyfill, 128+[31, 95, 95, 32], [31, 31, 95, 95], color=get_grey(), /dev
l=l_0
while l ne l_1 do begin
device, cursor_standard = l
tvcrs, 128+64,64, /dev
text2 = 'device, cursor_standard = '+strcompress(string(l))
xyouts, 32, 256-64, text1, font=0, /device
xyouts, 32, 256-128, text2, font=0, /device
polyfill, [31, 95, 95, 32], [31, 31, 95, 95], color=!d.n_colors-1, /dev
polyfill, 128+[31, 95, 95, 32], [31, 31, 95, 95], color=get_grey(), /dev
cursor, x, y, /wait, /dev
wait, 0.125
if !err eq 4 then goto, FINITUM
if !err eq 2 then l = l-1 else l = l+1
erase
endwhile
FINITUM :
device, /cursor_original
wdelete
return
end
|