[plt-scheme] extending gui.ss

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Dec 30 23:02:21 EST 2005

At Fri, 30 Dec 2005 19:48:12 -0500, Prabhakar Ragde wrote:
> But a user-defined button, as far as users of gui.ss are concerned, is 
> not a button% object, but a gui-item structure. So I need some way, in 
> the rewritten version of gui.ss, to take a button% (provided by MrEd 
> when the button is clicked) and find the corresponding gui-item so that 
> I can provide it to the user-supplied callback function. I don't quite 
> see how to do this. Can someone help?

Can you put a binding of the gui item into the environment of the
`call-back' call, something like this?:

  ;; Not tested at all!
  (define (make-button label call-back)
    (check-arg 'make-button (string? label) "string" 'first label)
    (check-proc 'make-button call-back 1 'second "1 argument")
    (letrec ([gui-item
               (lambda (the-panel)
                 (lambda (b e)
                   (check-result 'button-callback boolean? "Boolean" 
                   (call-back gui-item))))))])


Posted on the users mailing list.