Common Lisp Interface Manager 2.0 User's Guide > Chapter 17 Formatted Output > 17.1 Formatting Tables in CLIM > 17.1.3 Examples of Formatting Tables

NextPrevUpTopContentsIndex

17.1.3.4 Formatting a Table With Irregular Graphics in the Cells

The example3 function shows how you can format a table in which each cell contains graphics of different sizes.

(defun example3 (&optional (items *alphabet*)    
                 &key (stream *standard-output*) (n-columns 6) 
                      y-spacing x-spacing) 
  (clim:formatting-table
      (stream :y-spacing y-spacing   
              :x-spacing x-spacing) 
   (do ()
       ((null items)) 
     (clim:formatting-row (stream) 
        (do ((i 0 (1+ i)))
            ((or (null items) (= i n-columns))) 
          (clim:formatting-cell (stream)    
             (clim:draw-polygon* stream  
                                (list 0 0 (* 10 (1+ (random 3))) 
                                      5 5 (* 10 (1+ (random 3)))) 
                                :filled nil) 
            (pop items))))))) 

Evaluating (example3 *alphabet* :stream *my-stream*) shows this table:

 

Figure 28. Example3 Table

Common Lisp Interface Manager 2.0 User's Guide - 22 Dec 2009

NextPrevUpTopContentsIndex