Changeset main,80 for main/form.lisp
- Timestamp:
- 12/13/2007 12:47:56 AM (18 years ago)
- branch-nick:
- tui
- revision id:
- dsowen@fugue88.ws-20071213004756-lr4quvaf0hy1zpub
- File:
-
- 1 edited
-
main/form.lisp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
main/form.lisp
r79 r80 55 55 56 56 (defun make-textbox-def (row column name display-width 57 &key data-width read-only (validat e 'nothing)57 &key data-width read-only (validator 'identity) 58 58 (inactive-background 59 59 *default-inactive-widget-background*) … … 64 64 :display-width ,display-width :data-width ,data-width 65 65 :read-only ,read-only 66 :validator ',validat e66 :validator ',validator 67 67 :inactive-background (list ,@inactive-background) 68 68 :active-background (list ,@active-background))) … … 70 70 (defun make-numberbox-def (row column name display-width 71 71 &key data-width precision read-only 72 (validat e 'nothing)72 (validator 'identity) 73 73 (inactive-background 74 74 *default-inactive-widget-background*) … … 79 79 :display-width ,display-width :data-width ,data-width 80 80 :precision ,precision :read-only ,read-only 81 :validator ',validat e81 :validator ',validator 82 82 :inactive-background (list ,@inactive-background) 83 83 :active-background (list ,@active-background))) … … 130 130 (create-label window row column text)))) 131 131 (:method ((tbd textbox-def) form) 132 (with-slots (row column name display-width inactive-background132 (with-slots (row column name validator display-width inactive-background 133 133 active-background) tbd 134 134 (with-slots (data window scroll) form 135 135 (let ((r (make-reflector data name))) 136 136 (create-textbox window (- row scroll) column r display-width 137 :validator validator 137 138 :inactive-background inactive-background 138 139 :active-background active-background))))) 139 140 (:method ((nbd numberbox-def) form) 140 (with-slots (row column name display-width inactive-background141 (with-slots (row column name validator display-width inactive-background 141 142 active-background) nbd 142 143 (with-slots (data window scroll) form 143 144 (let ((r (make-reflector data name))) 144 145 (create-numberbox window (- row scroll) column r display-width 146 :validator validator 145 147 :inactive-background inactive-background 146 148 :active-background active-background)))))) … … 256 258 (assert (> n 0) nil "The form has no fields.") 257 259 (labels ((f-idx () (aref focusables focus)) 258 (f-peer () (aref peers (f-idx))) 259 (f-def () (aref widget-defs (f-idx))) 260 (validate () 261 (let* ((v (slot-value (f-def) 'validator)) 262 (name (slot-value (f-def) 'name)) 263 (text (form-value data name)) 264 (r (funcall v text))) 265 (when r 266 (setf (form-value data name) r))))) 260 (f-peer () (aref peers (f-idx)))) 267 261 (loop 268 262 (ensure-widget-visible form (f-idx)) … … 271 265 (case key 272 266 ((#\Return #\Newline #\Tab :key-down) 273 #|(setf focus (mod (1+ focus) n))|#274 (validate)275 267 (incf focus) 276 268 (boundf focus 0 (1- n))) 277 269 ((:key-btab :key-up) 278 #|(setf focus (mod (1- focus) n))|#279 (validate)280 270 (decf focus) 281 271 (boundf focus 0 (1- n)))
Note: See TracChangeset
for help on using the changeset viewer.
