[plt-scheme] extending gui.ss
I recently had a question from a teacher in Germany about my extensions
to the gui.ss teachpack, which made me realize that I don't understand
gui.ss as well as I should.
Callbacks associated with MrEd objects are provided with the object and
the event which triggered the callback; gui.ss provides just the event
to the user-supplied callback function. HtDP readers don't know what to
do with this and have to ignore it. I thought it might make sense, for a
button, to provide the button to the user-supplied callback function.
Then one function could handle multiple buttons.
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? Many thanks. --PR