Hi Bastian, Am 15.02.2009 um 16:23 schrieb Bastian Müller:
Hi,I don't know if that has been discussed yet, but I've several use caseswhere I want to do sth. like that: A cell should be calculated by a formula if it isn't set to a value. I thought that's possible with(c-formula (:inputp t) ... ), which does calculate the slot by a formula and can be setf, but how is it possible to unset the setf value and letcells calculate it again? Example: A textbox is by default calculated by a formula. If the userenters sth. into it, that value is used. If the user clears the field ofhis input, the value should be calculated again. Maybe the c-formula ... approach is completely the wrong way or that'snot possible at all. I've read the documentation and primer but couldn'tfind anything helpful. Sorry, I'm new to cells. Cheers, Bastian
Hi Bastian (wow - another Cells user in Germany ;-) - We're three now)As Kenny and Jakub have suggested one common solution I find myself using from time to time is:
(defmd frgo ()
(entered-value (c-in nil))
(value (c? (or (^entered-value)
(computed-value)))))
(defun computed-value () ;;; Just making a simple function that fakes
a computed value
'computed)
(defun test-it ()
(let ((self (make-instance 'frgo)))
(format t "~&Entered value: ~s~%" (^entered-value))
(format t "~&Value: ~s~%" (^value))
(setf (^entered-value) 'entered)
(format t "~&Entered value: ~s~%" (^entered-value))
(format t "~&Value: ~s~%" (^value))))
Cheers
Frank
--
Frank Goenninger
Cell: +49 175 4321058
E-Mail: [email protected]
PGP.sig
Description: PGP signature
_______________________________________________ cells-devel site list [email protected] http://common-lisp.net/mailman/listinfo/cells-devel
