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

Re: Using arrow keys with dr



        Reply to:   RE>Using arrow keys with drawi
Bobby Yee writes:
> Or would I have to write a key-handler
> for the drawing window (which could be troublesome becuase I've never
> really understood how a key-handler works or how to write one...)?

; Here you are. Just replace the dummy finctions by your own
; to go from a selected node up, dow, right or left

(defclass tree-window (window)
  (
  )
  (:documentation
"")
  )

(defmethod level-up ()
  (format t "~%should be going up in tree of window ~a" (front-window))
  )

(defmethod level-down ()
  (format t "~%should be going down in tree of window ~a" (front-window))
  )


(defmethod left-sibling ()
  (format t "~%should be going left in tree of window ~a" (front-window))
  )


(defmethod right-sibling ()
  (format t "~%should be going right in tree of window ~a" (front-window))
  )

(defmethod view-key-event-handler ((win tree-window) char)
  (case char
   (#\UpArrow (level-up))
   (#\DownArrow (level-up))
   (#\BackArrow (level-up))
   (#\ForwardArrow (level-up))
   (t (call-next-method))))

(make-instance 'tree-window :window-title "I love 2-strokes")

Have fun, Andre

Andre Koehorst
Research Institute for Knowledge Systems
Maastricht, the Netherlands
email andre@riks.nl