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 
Switch to threaded view of this topic Create a new topic Submit Reply
Odd behavior of Device, cursor_image [message #29566] Tue, 26 February 2002 19:17 Go to next message
Thomas Launey is currently offline  Thomas Launey
Messages: 25
Registered: September 1999
Junior Member
;*** display a draw widget. As the cursor is moved close to the center
;*** of the widget, its appearance should change from "sad" to "happy"
Hello,
I have a problem with cursor shape control.
According to the documentation, calls to DEVICE are sticky and should
remain until explicitly changed to another value. However, it seems that
calls to DEVICE,cursor_image=pattern, cursor_XY=[8,8], cursor_mask=mask
do not follow this rule. The test program below should show the problem.
The shape of the cursor is supposed to change from a sad to a happy face
as the cursor it moved toward the center of the window. Somehow, on my
system (5.4, Win98) its blinking arrow/face as it is moved. Any help
would be most welcome.
Thanks
Thomas
PS: the integer array for cursor shape is not OS independent but even if
you don't see the face the problem should be obvious




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
Re: Odd behavior of Device, cursor_image [message #29587 is a reply to message #29566] Wed, 06 March 2002 01:13 Go 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
Re: Odd behavior of Device, cursor_image [message #29636 is a reply to message #29566] Sat, 02 March 2002 10:10 Go to previous message
Mark Rivers is currently offline  Mark Rivers
Messages: 49
Registered: February 2000
Member
Rikagaku <t_launey@brain.riken.go.jp> wrote in message
news:MPG.16e6de8fa5e6194b98968d@news.riken.go.jp...
> I have a problem with cursor shape control.
> According to the documentation, calls to DEVICE are sticky and should
> remain until explicitly changed to another value. However, it seems that
> calls to DEVICE,cursor_image=pattern, cursor_XY=[8,8], cursor_mask=mask
> do not follow this rule. The test program below should show the problem.
> The shape of the cursor is supposed to change from a sad to a happy face
> as the cursor it moved toward the center of the window. Somehow, on my
> system (5.4, Win98) its blinking arrow/face as it is moved. Any help
> would be most welcome.

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.

Mark Rivers
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Wed Oct 08 14:32:40 PDT 2025

Total time taken to generate the page: 0.00410 seconds