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

Re: Using enter keys for 'tabbing'



;;; I'm not sure that this is what you want.. but it does permit the
;;; enter/return keys to be used for tabbing through all of the editable
;;; text in a window.
;;;
;;; dataentry-editable-text-dialog-item                          [Class]
;;;
;;; Editable text items which can use 'enter' or 'return' keys
;;; to tab between fields.
;;; Missing: How to move backwards? (such as with Shift-Tab?)

(defclass dataentry-editable-text-dialog-item (editable-text-dialog-item)
  ())

(defmethod view-key-event-handler ((view dataentry-editable-text-dialog-item)
                                   char)
   (if (or (char-equal char #\Enter) (char-equal char #\Return))
    (change-key-handler view)
    (call-next-method)))

(make-instance 'window
               :view-size #@(200 200)
               :view-subviews
               (list
                (make-instance 'dataentry-editable-text-dialog-item
                               :view-size #@(150 20)
                               :view-position #@(25 10)
                               :allow-returns t
                               :dialog-item-text "First")
                (make-instance 'dataentry-editable-text-dialog-item
                               :view-size #@(150 20)
                               :view-position #@(25 90)
                               :allow-returns t
                               :dialog-item-text "Second")
                (make-instance 'dataentry-editable-text-dialog-item
                               :view-size #@(150 20)
                               :view-position #@(25 170)
                               :allow-returns t
                               :dialog-item-text "Third")
                ))

Sean Doyle
Massachusetts General Hospital