CLIM mail archive

[Prev][Next][Index][Thread]

Re: Quickie question on formatting-table




    Is it possible to use formatting-table, formatting-row, etc. within the
    context of accepting-values where each cell in the table would be an
    individual accept with its own prompt and default?  I'm not sure this is
    allowed by what was illustrated in the docs.
    
    That would be extremely handy if it is allowed.  Do I need to do anything
    special to implement this if it is possible?

Yes, it works, and no, you don't need to do anything special:
just make the pane an accepting-values pane, and put your accepts
inside formatting-cells.  I don't have a complete example handy,
but below is the macro I used for all my different tables.

denise
ddraper@cs.washington.edu

;;;----------
;;; The following macro captures the common pattern: it displays
;;; one editable value in the table.  When the value is edited,
;;; the associated code ('body') is executed.
;;; note: it assumes the variable 'stream' is appropriately bound

(defmacro accept-val (val type id &body body)
  `(formatting-cell (stream)
    (let (new-val new-type val-changed)
      (multiple-value-bind (new-val new-type val-changed)
	  (accept ,type
		  :stream stream
		  :default ,val
		  :prompt nil
		  :query-identifier ,id)
	(declare (ignore new-type))
	(when val-changed
	  (handler-case (progn ,@body)
	    (simple-error (c)
	      (show-error "~a" c))))))))



Main Index | Thread Index