[plt-scheme] The missing drawing context

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Mar 20 16:11:36 EDT 2009

At Fri, 20 Mar 2009 21:05:59 +0100, Jens Axel Soegaard wrote:
> Matthew Flatt wrote:
> > The example still doesn't give the pasteboard a dc --- which comes from
> > an editor-canvas%, for example.
> > 
> > If you add
> > 
> >  (define f (new frame% [label "test"]))
> >  (define c (new editor-canvas% [parent f][editor pasteboard]))
> > 
> > to the end of the program, then your callbacks are run.
> That does indeed work.
> But...
> Since the example (without the editor-canvas) displays
> the pasteboard and string snip correctly, there must
> have been a drawing context created by DrScheme in play?

I forgot that you're displaying the snip in DrScheme...

To show a snip, DrScheme makes a copy of the snip, instead of inserting
it directly. So, you'd need to override the editor-snip% `copy' and
pasteboard% `copy-self' methods to re-instantiate your class.

Posted on the users mailing list.