comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Odd behavior of Device, cursor_image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Odd behavior of Device, cursor_image [message #29587 is a reply to message #29566] Wed, 06 March 2002 01:13 Go to previous messageGo to previous message
Thomas Launey is currently offline  Thomas Launey
Messages: 25
Registered: September 1999
Junior Member
>
> Works fine in IDL 5.4 and IDL 5.5 on Windows NT. As the mouse is being
> moved the cursor is invisible, but when the mouse motion stops the cursor is
> correct, smiling more in the middle.

Well, the cursor should NOT be invisible during moving, it should only
toggle between "sad","neutral" and "happy". After each Widget_draw event
(mouse movement) the cursor mask is updated depending on the distance
between cursor and center and it should keep this updated appearance
until the next event. For you the cursor becomes invisible and for me it
goes back to the default appearance (arrow on WIN) between each event
which is not what it should do. Since calls to DEVICE are supposed to be
"sticky" (cf: IDL Help), I don't understand why my code does not work.
Any help would be most welcome
Cheers,
Thomas

For those interested, I repost the code. For some reason my newsreader
seems to be unable to "follow up" a thread.

PRO testcursor_event, event
Widget_control, Event.top, Get_Uvalue=Info, /no_copy
distance=SQRT((info.sizedraw[0]/2-event.x)^2+$
(info.sizedraw[1]/2-event.y)^2)$
/SQRT((info.sizedraw[0]/2.0)^2+(info.sizedraw[1]/2.0)^2)
set=(Fix(distance/0.3))<2
;*** change cursor face depending on the distance to the target
pattern=[0,-8185,6168,1056,1056,576,576,576,$
576,576,576,1056,1056,6168,-8185,0]
Case set of ;*** 1:smile, 2:neutral, 3:sad
0: mask=[-8185,-2017,7224,1632,13932,13260,13260,$
-31807,-31807,3024,13260,-14749,1632,7224,-2017,-8185]
1: mask=[-8185,-2017,7224,1632,13932,13260,13260,$
-31807,-31807,960,960,-2449,1632,7224,-2017,-8185]
2: mask=[-8185,-2017,7224,1632,13932,13260,13260,$
-31807,-31807,960,-15421,9828,5736,7224,-2017,-8185]
;*** smilling by default :-)
Else: mask=[-8185,-2017,7224,1632,13932,13260,13260,$
-31807,-31807,3024,13260,-14749,1632,7224,-2017,-8185]
EndCase
device,cursor_image=pattern, cursor_XY=[8,8], cursor_mask=mask
Widget_control, Event.top, Set_Uvalue=Info, /no_copy
end;*********************** end of testcursor_event

Pro testcursor
Device, Get_Screen_Size=screenSize
Sizedraw=[screenSize[0]/2,screenSize[1]/2]
testcursor_tlb = Widget_Base(/Column,$
title='testcursor',TLB_Frame_Attr=1)
drawWidgetID=widget_draw(testcursor_tlb, /Motion_events, $
Xsize=sizedraw[0], Ysize=sizedraw[1])
Widget_Control, testcursor_tlb, /Realize
Widget_control, drawWidgetID, get_value=windraw & windraw=windraw[0]
wset, windraw
info={ drawWidgetID: drawWidgetID,$ ; the draw widget ID
windraw: windraw,$ ; the direct graphic window
sizedraw: sizedraw} ; [xdim,ydim] size
WIDGET_CONTROL, testcursor_tlb, SET_UVALUE=info, /NO_COPY
XManager, 'testcursor',testcursor_tlb ,$
EVENT_HANDLER='testcursor_event', /no_block
return
End
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Need help on "Thunder Storm".
Next Topic: Re: Has USERSYM been defined?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 08:27:09 PDT 2025

Total time taken to generate the page: 0.06303 seconds