problem detecting ALT in mouse-moved

"Ronald Sudomo" <[email protected]> Fri, 28 May 2004 17:20:36 -0600
Newsgroups gmane.lisp.allegro
Message-ID <008401c4450a$66ee2890$04a8a8c0@mindmachine>
Hi all,

I'm having problem detecting ALT key in the window's "mouse-moved" method.
Below is my test code. SHIFT and CTRL seem to work, but ALT is only detected
once in a while. Is this because the menu shortcuts are interfering with it?
If so, is there a workaround? Any help is appreciated. Thanks.

--ron


;;--- BEGIN ---
(defclass mywindow (frame-window)
  ()
  (:default-initargs :owner (screen *system*) :scrollbars nil
    :title "Untitled" :width 300 :height 300))

(defmethod mouse-moved ((self mywindow) buttons cursor-position)
  (cond
   ((logtest alt-key buttons)
    (format t "ALT: ~A,~A~%" (position-x cursor-position) (position-y
cursor-position)))
   ((logtest control-key buttons)
    (format t "CONTROL: ~A,~A~%" (position-x cursor-position) (position-y
cursor-position)))
   ((logtest shift-key buttons)
    (format t "SHIFT: ~A,~A~%" (position-x cursor-position) (position-y
cursor-position)))))


#| Examples:

(defparameter *window1* (make-window :mywin :class 'mywindow :title
"window1"))

(defparameter *window2* (make-instance 'mywindow :title "window2"))

|#
;;--- END ---