[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Cursor with any size
- To: firstname.lastname@example.org
- Subject: Cursor with any size
- From: email@example.com (Jiqian Pan)
- Date: Tue, 8 Sep 92 14:20:47 -0400
- Cc: firstname.lastname@example.org
Hi, MCL experts:
Because the size of a cursor is limited by the Macintosh O/S,
I used the following way to simulate a cursor with any size:
* Set a regular cursor to nothing, that is, we can't see it
in a window,
* Display an object such as a big hand on a window,
* Move the object as mouse moves.
Moreover, other events such as keystroke should be done while
mouse moves. Here is some code about the job:
;;; Detect an object, erase it and redraw it in a new position.
;;; item is an object with bitmap-dialog-item.
(defun my-cursor (position)
(let* ((last-pos position) c-pos (tolerance 3)
(mypos (view-position item))
(delta (subtract-points last-pos mypos)))
(setq c-pos (view-mouse-position (view-container item)))
(when (or (>= (abs (- (point-h c-pos) (point-h last-pos))) tolerance)
(>= (abs (- (point-v c-pos) (point-v last-pos))) tolerance))
(setq last-pos c-pos)
(let* ((mypos (view-position item))
(mybotright (add-points mypos (view-size item))))
(erase-rect (view-container item)
(point-h mypos)(point-v mypos)
(point-h mybotright)(point-v mybotright))
(set-view-position item (subtract-points c-pos delta))
;;; Move a cursor looply.
(defun run ( )
(do ((pt (view-position item)(view-position item))) (( ))
;;; Process key event, just seeing whether the method works.
(defmethod view-key-event-handler ((toy my-window) char)
;;; New cursor is called when the object is clicked.
(defmethod view-click-event-handler ((item bitmap-dialog-item) position)
;;; New cursor.
The interesting thing is that the method view-key-event-handler does
not work, that is, the word "key" can't be seen in Listener, when the
function RUN is called inside the method view-click-event-handler.
But the method works when the function RUN is run directly in Listener.
Does anyone know the problem, and other good ways to simulate a cursor
with any size? Thanks.