<div><br></div><div>Hi Martin,<br></div><div><br></div><div>This should be possible--and as a matter of fact I used similar functionality in my MSc project. I had a table in which I could enter numbers, symbols, and even functions (which--using cells--got compiled in real time like this: (compiled-fn :initform (c? (compile ^fn))) )</div>
<div><br></div><div>I will try to locate the code later (unfortunately I am on a business trip right now, but I might find it somewhere anyways ...)</div><div><br></div><div>Best</div><div>Peter</div><div><br></div><div>PS. We're seeing a lot of traffic (comparably) on this list lately. It's great to see people actually using cells-gtk.</div>
<br><div class="gmail_quote">On Tue, Oct 6, 2009 at 8:37 PM, Martin Kielhorn <span dir="ltr"><<a href="mailto:kielhorn.martin@googlemail.com">kielhorn.martin@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>I want a table with numbers and when I click on one number I want to change it to<br>a new value. I managed to copy the table from test-gtk/test-tree-view.lisp and I added<br>:editable t to the def-columns call. I can edit the number, but the system doesn't store<br>
the value back into one of my variables, e.g. (position$ (nth 2 *items*)). So when I press<br>enter after the edit, the old value will be shown again.<br><br>I hoped the :on-edit slot of listbox could be used for this task but the format is never executed.<br clear="all">
<br>Or is it only possible to do it like in the Cells-Tree-View example?<br>It seemed quite complicated to me, as I don't want two copies of branched trees.<br>I think that is the next thing I would be glad to hear how :on-edit is to be used.<br>
<br>[I run the following code in sbcl with threads.]<br><br>(require :asdf)<br>(require :cells-gtk)<br><br>(defpackage :mk<br> (:use :cells :cl :cells-gtk))<br><br>(in-package :mk)<br><br>(defmodel myapp (gtk-app)<br> ()<br>
(:default-initargs :width 400 :height 300<br> :md-name :mk-top<br> :kids (c-in nil)))<br>(init-gtk)<br>(start-win 'myapp)<br><br>(defmodel listbox-test-item ()<br> ((position :accessor position$ :initarg :position :initform nil)<br>
(curvature :accessor curvature$ :initarg :curvature :initform nil)))<br><br>(defparameter *items*<br> (list (make-be 'listbox-test-item<br> :position (coerce (random 20) 'double-float) <br> :curvature (coerce (random 20) 'double-float))<br>
(make-be 'listbox-test-item<br> :position (coerce (random 20) 'double-float)<br> :curvature (coerce (random 20) 'double-float))))<br><br>(let ((top (find-widget :mk-top)))<br> (setf<br>
(kids top)<br> (list <br> (mk-vbox<br> :fm-parent top<br> :kids <br> (kids-list?<br> (mk-listbox :md-name :listbox<br> :selection-mode :single<br> :columns (def-columns<br> (:double (:title "Position") (lambda (node) '(:editable t)))<br>
(:double (:title "Curvature")))<br> :items *items*<br> :print-fn (lambda (item)<br> (list (position$ item)<br> (curvature$ item)))<br> :on-edit (lambda (node col new-val)<br>
(format t "~a~%" (list node col new-val)))))))))<br><br><br>Regards, Martin<br><font color="#888888">-- <br>Martin Kielhorn<br>Randall Division of Cell & Molecular Biophysics<br>King's College London, New Hunt's House<br>
Guy's Campus, London SE1 1UL, U.K.<br>tel: +44 (0) 207 848 6519, fax: +44 (0) 207 848 6435<br>
</font><br>_______________________________________________<br>
cells-gtk-devel site list<br>
<a href="mailto:cells-gtk-devel@common-lisp.net">cells-gtk-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/mailman/listinfo/cells-gtk-devel" target="_blank">http://common-lisp.net/mailman/listinfo/cells-gtk-devel</a><br></blockquote></div><br>