[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about Presentations
Date: Sat, 13 Oct 90 19:35 EDT
From: RWK@fuji.ila.com (Robert W. Kerns)
Date: Fri, 12 Oct 90 14:50:08+0900
From: kddlab!harl.hitachi.co.jp!mklein@uunet.uu.net
I am trying to "present" an object to a screen with a label different
from the usual printed representation of the object. When I mouse-select
...
Thanks very much,
Mark Klein
...
Konban wa, Kurain-san.
The problem is your use of (FORMAT STREAM "~A" LABEL), if label
is not a string, creates a presentation, because FORMAT calls
WRITE in that case. This presentation will be a SYMBOL presentation,
and since SYMBOL is a subtype of EXPRESSION, it will satisfy your
call to ACCEPT. (When multiple presentations could apply, the system
always chooses the innermost).
Here are a couple ways to do what you want:
(defun present-as (object label &key (stream *standard-output*))
"Presents object to stream with given label"
(dw:with-output-as-presentation (:single-box t
:type (type-of object)
:stream stream
:object object)
(format stream "~a" (string label))))
Or more efficiently:
(defun present-as (object label &key (stream *standard-output*))
"Presents object to stream with given label"
(dw:with-output-as-presentation ...
(write-string (string label) stream)))
Alternatively, you could use
(defun present-as (object label &key (stream *standard-output*))
"Presents object to stream with given label"
(dw:with-output-as-presentation (:single-box t
:type (type-of object)
:stream stream
:ALLOW-SENSITIVE-INFERIORS NIL
:object object)
(print-any-way-you-like label stream)))
This avoids second guessing the various print functions, especially if
the `label' evolves into a more complicated call to format. It also
disables any nested presentations that you might WANT sensitive.
bruce