[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with *cursorhook* ?

When I set *cursorhook* to a cursor I have obtained from a resource
file, the cursor shape appears as desired.  When I reset *cursorhook*
to nil, the system doesn't seem to track the cursor correctly.

For example, when a cursor is over the scoll bars in a fred window,
the cursor shape remains an I-beam.  Clicking on a scroll bar changes
the cursor to an arrow, but then it remains an arrow until you click
in the content region of the fred window where it then returns to an

Furthermore, if you initiate an event with *cursorhook* bound to
a different cursor than the default cursor, the cursor changes to the
default cursor.  For example, let's say that I have set *cursorhook*
to some *foo-cursor*.  Selecting some text in a fred-window (by 
clicking and dragging) changes the shape of the cursor from *foo-cursor*
to the normal I-beam for a fred-window.  From my understanding of
*cursorhook*, this shouldn't happen - the cursor should remain
*foo-cursor* no matter what the user does if *cursorhook* is bound.

I look forward to any replies, as completely controlling the shape
of the cursor is critical to my application.  THANKS.

Here is some code:

(defvar *foo-cursor* nil)

(defmacro get-and-detach-cursor (the-cursor id)
     (setf ,the-cursor (#_Get1Resource "CURS" ,id))    
     (#_HNoPurge ,the-cursor)    
     (#_DetachResource ,the-cursor)))

(defun initialize-cursors ()
  (with-open-resource-file (res-file-id "ccl:SPIF;SPIF.rsrc")
    (get-and-detach-cursor *foo-cursor*          129)

? *foo-cursor*
#<A Mac Handle, Unlocked, Size 68 #x385644>
? (setf *cursorhook* *foo-cursor*)
#<A Mac Handle, Unlocked, Size 68 #x385644>

 ; the cursor looks like *foo-cursor* but it reverts to the standard 
 ; or default cursor during event processing

? (setf *cursorhook* nil)

  ; cursor tracking is lost!