[racket] gui application needs to perform operation upon closing of a window

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Wed May 22 22:06:14 EDT 2013

Ah ok I see now. I didn't look hard enough.

I saw the "frame%" so I was clicking around here:
http://docs.racket-lang.org/tools/drracket_unit.html?q=on-close#%28meth._%28%28%28lib._drracket%2Ftool-lib..rkt%29._drracket~3aunit~3aframe~25%29._on-close%29%29

On Wed, May 22, 2013 at 7:59 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> From the docs:
>
> "
> method
>   (send a-top-level-window on-close) → void?
>
> Refine this method with augment.
> ...
> "
>
>
>
> On May 22, 2013, at 7:14 PM, Stephen Chang wrote:
>
>> I was about to reply with the same answer as Matthias, but with
>> define/override instead of define/augment, but I kept getting an
>> error. Does it say anywhere in the docs whether a method is declared
>> using pubment or public? I couldnt find it.
>>
>> On Wed, May 22, 2013 at 7:06 PM, Matthias Felleisen
>> <matthias at ccs.neu.edu> wrote:
>>>
>>> Here we go:
>>>
>>> #lang racket/gui
>>>
>>> (define my-frame%
>>>  (class frame%
>>>    (super-new)
>>>    (define/augment (on-close)
>>>      (displayln "closing now"))))
>>>
>>> (define frame
>>>  (new my-frame% [label "on closing"][width 300][height 200]))
>>>
>>> (send frame show #t)
>>>
>>>
>>>
>>> On May 22, 2013, at 6:55 PM, Zelah Hutchinson wrote:
>>>
>>>> From the documentation I gather that I need to augment the on-close method. I do not understand how to do this. Can someone show me a tiny example of how to perform an operation when a window is closed? Thank you.
>>>>
>>>> ____________________________________________________________
>>>> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
>>>> Check it out at http://www.inbox.com/marineaquarium
>>>>
>>>>
>>>>
>>>> ____________________
>>>> Racket Users list:
>>>> http://lists.racket-lang.org/users
>>>
>>>
>>> ____________________
>>>  Racket Users list:
>>>  http://lists.racket-lang.org/users
>


Posted on the users mailing list.