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

view-key-event-handler extension for Interface Tools



Have you tired of moving dialog items around with the mouse to get them
lined up "just right"? Well, I have, and so this morning I took a few
minutes to add the following code to the file "Dialog Editor.lisp"
in the "Interface Tools" file. (I placed this code right after
view-click-event-handler.

Enjoy!

;; move selected dialog items based on the arrow keys
;;
(defmethod view-key-event-handler :around ((window window) char)
  (if (and (ccl::editing-dialogs-p window)
           (member char '(#\UpArrow #\ForwardArrow #\BackArrow #\DownArrow)))
    (with-focused-view window
      (dolist (item *selected-dialog-items*)
        (highlight-one-selected-item window item t nil)
        (set-view-position 
         item
         (case char
           (#\UpArrow      (add-points (view-position item) #@(0 -1)))
           (#\ForwardArrow (add-points (view-position item) #@(1 0)))
           (#\BackArrow    (add-points (view-position item) #@(-1 0)))
           (#\DownArrow    (add-points (view-position item) #@(0 1)))))
        (highlight-one-selected-item window item t t)))
    (call-next-method)))


-----------------------------------+--------------------------------------
Luke Hohmann                       | hohmann@csmil.umich.edu
University of Michigan             | 313-763-1043 (Office)
Artificial Intelligence Laboratory | 313-677-0952 (Home)
1101 Beal Ave                      | 
Ann Arbor, MI 48109-2110           | "You should do more aerobics!"