[plt-scheme] show a snip in interactions pane

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Wed Nov 11 18:48:51 EST 2009

I was trying to draw colored strings by overriding the `draw' method of 
string-snip% but my string is always drawn in black (foreground) and 
white (background). Is it because the interactions pane always prints 
the raw text from `get-text' ?

(define (text-snip text)
  (new
   (class string-snip%
     (define/override (draw dc x y left top right bottom dx dy draw-caret)
       (send dc set-text-foreground (make-object color% 255 0 0)))
     (super-new)
     (send this insert text (string-length text)))))
    
(text-snip "hello")


Posted on the users mailing list.