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

Home » Public Forums » archive » cursor testcase
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
cursor testcase [message #30921] Tue, 28 May 2002 21:02 Go to previous message
Ted Cary is currently offline  Ted Cary
Messages: 53
Registered: October 2001
Member
Hello all,

Probably no one read my rambling list of cursor problems from a week or so
ago. The glitches are not serious but they bother me, so I wrote a testcase
appended to the end of this post. To summarize:

On Macs (IDL 5.4), object graphics window cursors inexplicably change to the
current direct graphics cursor when the user mouses through a window with
the mouse button held down. This is if MOTION_EVENTS are being generated.

On Windows PCs (IDL 5.5), setting direct graphics cursors causes a new
direct graphics window to pop up if none is open already. Maybe there is a
reason or a workaround?

The two glitches together are especially annoying if you are trying to write
cross-platform applications, although it is possible the problem is related
to the different IDL versions (?).

Suggestions? (besides writing platform-specific code)

Thank you,

Ted Cary

;+
; NAME:
;
; Scribble
;
; PURPOSE:
;
; This is a barebones object graphics drawing program that
; demonstrates an object graphics cursor problem.
;
; 1) On Mac (IDL 5.4) platforms, holding down the left button while
; moving the mouse in object graphics windows causes the
; cursor to cycle between the object graphics cursor and the
; direct graphics cursor. This can be solved by setting the
; direct graphics cursor to the same image as the object graphics
; cursor, but...
; 2) On Windows (IDL 5.5) platforms, setting the direct graphics
cursor
; causes a direct graphics window to appear if one is not
; already open.
;
; These two bugs together make it necessary to write platform-
; specific code to change cursors in object graphics.
;
; AUTHOR:
;
; Ted Cary
;
; CATEGORY:
;
; Bug demonstration, proof that I'm not imagining things.
;
; CALLING SEQUENCE:
;
; Scribble
;
; PROCEDURE:
;
; Draw in the object graphics window by moving the mouse.
; Stop moving and double-click to clear the window.
;
; On a Mac (IDL 5.4), if you hold the button down while drawing, the
cursor
; changes from the pencil to the direct graphics standard. This is a
bug--
; you should never see the direct graphics cursor in the object window
; unless they are both set to the same image.
;
; On a Windows Machine (IDL 5.5), if no direct graphics windows are
open
; when the program is run, then a window appears for half a second
; before being destroyed. This is because calls to the DEVICE
procedure to
; change the cursor will open new direct graphics windows. Possibly
there
; is some reason for this (?), but it appears to be another glitch.
It
; does not occur on the Macintosh (IDL 5.4).
;
;

PRO Scribble_Cleanup, wTLB


Widget_Control, wTLB, Get_UValue=info, /No_Copy

; Destroy all objects in info structure.

FOR i=0, N_Tags(info) - 1 DO BEGIN
IF Obj_Valid(info.(i)) THEN BEGIN
Obj_Destroy, info.(i)
ENDIF
ENDFOR
END;-------------------------------------------------

PRO Scribble_Event, ev


Widget_Control, ev.top, Get_UValue=info, /No_Copy
CASE ev.type OF

; Clear ROI on double click.

0 : IF ev.clicks EQ 2 THEN BEGIN
info.oModel->Remove, info.oROI
Obj_Destroy, info.oROI
info.oROI = Obj_New('IDLgrROI', Style=1, Color=[255, 0, 0])
info.oModel->Add, info.oROI
info.oWindow->Draw, info.oView
ENDIF

; Append data to ROI while cursor is moving.

2 : BEGIN
info.oROI->AppendData, [ev.x, ev.y]
info.oWindow->Draw, info.oView
ENDCASE

ELSE :
ENDCASE

Widget_Control, ev.top, Set_UValue=info, /No_Copy
END;-------------------------------------------------

PRO Scribble


; Setup and realize widgets.

wTLB = Widget_Base(Title='Scribble')
wDraw = Widget_Draw( $
wTLB, $
/Button_Events, $
Graphics_Level=2, $
/Motion_Events, $
Renderer=1, $
Retain=0, $
XSize=400, $
YSize=400 $
)
Widget_Control, wTLB, /Realize

; Setup and draw the graphics tree.

Widget_Control, wDraw, Get_Value=oWindow
oView = Obj_New( $
'IDLgrView', $
ViewPlane_Rect = [0, 0, 400, 400] $
)
oModel = Obj_New('IDLgrModel')
oROI = Obj_New('IDLgrROI', Style=1, Color=[255,0,0])
oModel->Add, oROI
oView->Add, oModel
oWindow->Draw, oView

; Store object references in info structure.

info = { $
oModel : oModel, $
oROI : oROI, $
oView : oView, $
oWindow : oWindow $
}
Widget_Control, wTLB, Set_UValue=info, /No_Copy

; Change object graphics window cursor to a fat pencil.

cursorPencil = [ $
7680, 8448, 8448, 9088, 7296, 4160, 2112, 2080, $
1056, 1040, 528, 528, 304, 240, 112, 48 $
]
ByteOrder, cursorPencil
oWindow->SetCurrentCursor, $
HotSpot = [6,0], $
Image=cursorPencil, $
Mask=cursorPencil

; Make sure the direct graphics cursor is set to "standard."

IF !Window GE 0 THEN BEGIN
Device, /Cursor_Standard
ENDIF ELSE BEGIN
Device, /Cursor_Standard

; If using Windows, delete the annoying window that pops up.

IF StrUpCase(!version.os_family) EQ 'WINDOWS' THEN BEGIN
Wait, 0.5
WDelete
ENDIF
ENDELSE

; XManage events and cleanup.

XManager, 'scribble', wTLB, Cleanup='scribble_cleanup', /No_Block
END;-------------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Widgets
Next Topic: Image outline

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

Current Time: Sat Oct 11 12:41:06 PDT 2025

Total time taken to generate the page: 0.79963 seconds