[plt-scheme] show a snip in interactions pane

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Wed Nov 11 20:13:20 EST 2009

I believe DrScheme makes a copy of the snip before inserting it into the 
interactions editor. Since you aren't overriding <the right stuff>, the 
"copy" is probably just a string-snip%.

<the right stuff> might be just the snip% copy method. Or it might be 
the whole snip-class infrastructure. I'm not sure. Try implementing copy 
first and see if that works.

Ryan

Jon Rafkind wrote:
> 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")
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.