[plt-scheme] DrScheme Printing of picts
Hi all,
By default a pict is printed in the interaction window of DrScheme as
a real picture and not as a <struct:pict>, however if you have a
function foo which returns a pict and if you do (write (foo)),
(display (foo)) or (printf "~a" foo), in all cases you get
<struct:pict>.
How is DrScheme printing the picts? I though that grabbing the
current-display/print/write-handler would do the job but neither of
these work.
My real need is the following. I want be able to grab the object which
results in the evaluation and if it is some kind of specific object I
know it calls foo with it to return a custom pict to be printed as an
image, else I just release the object to drscheme care.
I tried:
(let ([old-display-handler (port-display-handler (current-output-port))])
(port-display-handler (current-output-port)
(lambda (val port)
(if (is-a? val myobj<%>)
(old-display-handler (foo val) port)
(old-display-handler val port)))))
but this is not working. It's printing the pict resulting of foo as
<struct:pict>. Any ideas?
Thanks,
--
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group