[cells-gtk-devel] Editable Table

Martin Kielhorn kielhorn.martin at googlemail.com
Thu Oct 8 10:25:48 UTC 2009


It turns out if I store the data as strings, editing will work as expected.
With this definition of *items*:

(defparameter *items*
  (list (make-be 'listbox-test-item
         :position  (prin1-to-string (coerce (random 20) 'double-float))
         :curvature (prin1-to-string (coerce (random 20) 'double-float)))
    (make-be 'listbox-test-item
         :position  (prin1-to-string (coerce (random 20) 'double-float))
         :curvature (prin1-to-string (coerce (random 20) 'double-float)))))

and the following change to :columns

> (let ((top (find-widget :mk-top)))
>   (setf
>    (kids top)
>    (list
>     (mk-vbox
>      :fm-parent top
>      :kids
>      (kids-list?
>       (mk-listbox :md-name :listbox
>           :selection-mode :single
>           :columns (def-columns
>                 (:double (:title "Position") (lambda (node) '(:editable
> t)))
>                 (:double (:title "Curvature")))
>
           :columns (def-columns
                   (:string (:title "Position") #'(lambda (node) '(:editable
t)))
                   (:string (:title "Curvature")))

>           :items *items*
>           :print-fn (lambda (item)
>                   (list (position$ item)
>                     (curvature$ item)))
>           :on-edit (lambda (node col new-val)
>                  (format t "~a~%" (list node col new-val)))))))))
>

The output looks like this:

"----------UTILSRESET----------------------------------"
0> c-link> query link :mk-top cells-store1 nil
0> overwriting item :listbox listbox
*
(<unknown>:6092): Gtk-CRITICAL **: gtk_tree_store_set_value: assertion
`GTK_IS_TREE_STORE (tree_store)' failed
(#<LISTBOX-TEST-ITEM {C474379}> 0 8.0d0)

(<unknown>:6092): Gtk-CRITICAL **: gtk_tree_store_set_value: assertion
`GTK_IS_TREE_STORE (tree_store)' failed
(#<LISTBOX-TEST-ITEM {C474379}> 0 8.0d30)


--
Martin Kielhorn
Randall Division of Cell & Molecular Biophysics
King's College London, New Hunt's House
Guy's Campus, London SE1 1UL, U.K.
tel: +44 (0) 207 848 6519,  fax: +44 (0) 207 848 6435
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cells-gtk-devel/attachments/20091008/e57e8eb3/attachment.html>


More information about the cells-gtk-devel mailing list