[plt-scheme] Re: plt-scheme Digest, Vol 2, Issue 16

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Sat Oct 8 13:16:57 EDT 2005

Robby wrote:
> You might try overriding the on-close method in the window to do 
> something. You'll need to create a subclass of the frame% class to do
>  so, like this:
> (define my-frame% (class frame% (define/override (on-close) (printf
> "plink\n")) (super-new)))

I had to define/augment instead of define/override, but otherwise this
works fine. Where you "plink", I need to clean up, and set a flag so 
that the user program blocking on the semaphore will gracefully exit 
rather than immediately recreate the window with the next slide!

Matthias wrote:
> If this is for complete novices (101), you may wish to dump the text
> on the screen via world.ss. The on-key-event handler will then allow
> going back and forth in the slideshow.

These aren't complete novices; as with Kathi's students, they will have 
gone through most of HtDP (in fact, farther than hers, through Section 
43), and this is for supplementary lectures at the beginning of second 
term for those who know Java, while the others go through a crash course 
in it. Furthermore, I don't think your idea quite fits into her 
development, in which the talk creator writes down a list of slide 
commands which are then "run" to produce the slideshow. Backing up in 
the slideshow would be tatamount to backing up in the talk "program", 
which is an interesting exercise, but tangential. (I have to remember to 
throw this out as a challenge.)

With Matthew and Robby's suggestions, I have about twenty lines of code 
to set up the editor canvas and auxiliary variables, and the slide 
functions are a few lines of code each, for instance:

   (define (add-to-slide newstr)
     (send t lock #f)
     (send t insert newstr (send t last-position))
     (send t lock #t)
     (send f show #t))

I think this is the right level of accessibility for those who take the 
trouble to look at the teachpack I'm giving them, though in fact they 
won't have to look at it at all; it's just a different way to illustrate 
the notion of several layers of implementation. --PR

Posted on the users mailing list.