CLIM mail archive


How-to presentation type question

    Date: Tue, 28 Jul 1992 17:00 EDT
    From: Greg Siegle <>

    Hi there,
       I'd like to implement a presentation type something like
    clim:member-alist which changes the color of a selected item rather
    than boldfaces them. Also I need to be able to specify that some of
    the items in a given alist are to be bold-faced. User selection of a
    presentation will not change whether an item is bold-faced.  Can this
    be done as a presentation type abbreviation of clim:completion? So far
    it's seemed much more difficult than I believe it should be... Is
    there an easy way to implement this? 
       I'm working in Lucid CLIM 1.1 on an IBM RS/6000.
       Thanks in advance.
	      -- Greg

I used this kludge in a program I wrote recently.  I hope that we come
up with a cleaner interface for CLIM 2.0.  I'm sure you can tailor this
to fit your requirements...

(define-presentation-type line-thickness ()
  :inherit-from `(integer 1 4))

(define-presentation-method accept-present-default ((type line-thickness) stream
						    (view dialog-view)
						    default default-supplied-p
						    present-p query-identifier)
  (declare (ignore default-supplied-p present-p))
  (flet ((presenter (thing stream)
	   (let ((y (stream-line-height stream)))
	     (with-room-for-graphics (stream)
	       (draw-rectangle* stream 0 2 16 (- y 2)
				:filled nil :ink +background+)
	       (draw-line* stream 0 (floor y 2) 16 (floor y 2)
			   :line-thickness thing)))))
    (declare (dynamic-extent #'presenter))
      stream '(("1" 1) ("2" 2) ("3" 3) ("4" 4))
      #'second default #'eql type query-identifier
      #'(lambda (choice-value query-value)
	  (declare (ignore query-value))
      #'(lambda (continuation object stream)
	  (surrounding-output-with-border (stream)
	    (funcall continuation object stream)))
      'clim::accept-values-one-of #'presenter)))


Main Index | Thread Index