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>-- <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>