[plt-scheme] show a snip in interactions pane

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Nov 11 20:42:24 EST 2009

Yes, it calls the copy method. But in general, you may have to follow
all of the instructions in the snip% documentation to make sure
everything works. (Another good test is are putting your snip into the
definitions window and saving the file.)

Robby

On Wed, Nov 11, 2009 at 7:13 PM, Ryan Culpepper <ryanc at ccs.neu.edu> wrote:
> 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
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.