NextPrevUpTopContentsIndex

print-collection-item

Generic Function
Summary

Prints an item as a string.

Package

capi

Signature

print-collection-item item collection

Arguments

item

An item or an Lisp object.

collection

A collection or any Lisp object.

Description

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 .

Example
(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")))))
See also

get-collection-item
collection


LispWorks CAPI Reference Manual - 25 Jul 2006

NextPrevUpTopContentsIndex