CLIM mail archive


filling-output and cells

   Date: Fri, 2 Oct 92 19:09:04 EDT
   From: Clinton Hyde <>

   I'm trying to use filling-output inside a cell, and have the resulting
   text centered both x and Y. it appears not to be centering.

   anyway, I want the text exactly centered across multiple linebreaks,
   and the circle is to be centered with the text, as [very] roughly
   shown. i've used :align-x and :align-y with :centered.

   is this a bug?

Well, it's not really a bug.  The :align options to formatting-cell
say what to do with the contents of a cell that isn't as wide as the
widest cell in the column.  That is, for a cell that doesn't fill all
the space allocated for cells in that column, should we push the cell
to the left, right or center of the column.

What you want is for the individual filled lines that filling-output
produces to be centered.  This feature would have to be added to
filling output.

This modification of your code example should run stand-alone.

  '(("long string one" "long string two" "long string three")
    ("one" "two" "three"))


  '(("long string one" "long string two" "long string three")
    ("one" "two" "three"))

(DEFUN print-patient-pp-data (stream list-of-lists-of-strings
				     &optional (x-align :left))
  (window-clear stream)
  (clim:formatting-table (STREAM 
			   :inter-row-spacing 20
			   :equalize-column-widths t
			   :multiple-columns 6
			   :multiple-columns-inter-column-spacing '(50 :pixel))

    (dolist (row list-of-lists-of-strings)
      (clim:formatting-row (STREAM)
	(dolist (pp row)
	  (clim:formatting-cell (STREAM :align-x x-align :align-y :center)
	    (clim:with-output-as-presentation (:object pp :stream stream :single-box t)
	      ;;now draw the circle...
	      (clim:draw-circle* stream 25 25 50
				 :filled t
				 :ink clim:+flipping-ink+
	    ;;drawing the string MUST occur after the circle.
	    ;;now draw the text, inverting the bits over the rectangle and the circle.
	    (clim:with-drawing-options (stream :ink clim:+flipping-ink+
	      (clim:with-text-family (:sans-serif stream)
		(clim:filling-output (stream :fill-width '(100 :pixel))
				     (princ pp stream))
  (force-output stream)


Follow-Ups: References:

Main Index | Thread Index