The generic function print-collection-item
prints
item
as a string. It is used when
item
is known to be an item in
collection
.
An item in a collection prints using the first of these which returns non-nil: the item's
text
, the item's
print-function
, the collection's
print-function
or the item's
data
. An item not known to be in the collection is printed simply using print-object
.
The method on (t collection)
uses the collection's
print-function
.
(setq collection (make-instance
'capi:collection
:items '(1 2 3 4 5)
:print-function #'(lambda (x)
(format nil
"<~A:>"
x))))
(capi:print-collection-item 2 collection)
In this example we provide our own print-collection-item
method:
(defclass my-tree-view (capi:tree-view) ())
(defmethod capi:print-collection-item ((item capi:item)
(tree my-tree-view))
(string-capitalize (svref (capi:item-data item) 0)))
(capi:contain
(make-instance 'my-tree-view
:roots
(list (make-instance 'capi:item
:data
(vector "foo")))))
CAPI User Guide and Reference Manual (Windows version) - 25 Feb 2015