Ignore:
Timestamp:
02/23/2008 12:27:43 AM (18 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui
revision id:
dsowen@fugue88.ws-20080223002743-09u28trz6kvjtdpo
Message:
  • Integrate checkboxes into forms.
  • Fixed checkbox display glitches.
  • Added keystrokes to checkbox.
  • Fixed package symbols.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/widget/checkbox.lisp

    r84 r87  
    2626   (cue-window :initarg :cue-window)
    2727   (data-window :initarg :data-window)
    28    (active :type boolean :initform nil)))
     28   (active :type boolean :initform nil :accessor active)))
    2929
    3030
     
    3737    (setf (background data-window)
    3838          (if active active-background inactive-background))
    39     (add-clipped-string data-window 0 0 (if (checked cb) "X" " "))
     39    (add-clipped-string data-window 0 0 (if (checked cb) "X" "-"))
    4040    (setf (cursor-position data-window) '(0 0))
    4141    (refresh cue-window)))
     
    4646    (when listener
    4747      (funcall listener))))
     48
     49(defmethod (setf active) :after (flag (cb checkbox))
     50  (draw cb))
    4851
    4952
     
    6871(defmethod activate ((cb checkbox) &key (key-callback 'nothing)
    6972                     &allow-other-keys)
    70   (with-slots (data-window active) cb
    71     (with-accessors ((checked checked)) cb
    72       (set-cursor-visible t)
     73  (with-slots (data-window) cb
     74    (with-accessors ((active active) (checked checked)) cb
     75      #|(set-cursor-visible t)|#
    7376      (setf active t)
    7477      (unwind-protect
     
    7881                (let ((key (read-key data-window)))
    7982                  (case key
     83                    ((#\x #\X)
     84                     (setf checked t))
     85                    (#\-
     86                     (setf checked nil))
    8087                    (#\Space
    8188                     (setf checked (not checked)))
     
    8592                         (return r))))))))
    8693        (setf active nil)
    87         (set-cursor-visible nil)))))
     94        #|(set-cursor-visible nil)|#))))
Note: See TracChangeset for help on using the changeset viewer.