[racket] How to handle exit of a GRacket application?
You probably want to augment `on-close' in `frame%', for example:
#lang racket/gui
(send
(new (class frame% (super-new)
(define/augment (on-close)
(displayln "Exiting...")))
[label "Frame"]
[width 400] [height 200])
show #t)
which on my machine prints "Exiting..." when I click to closing cross.
Laurent
On Sun, Sep 8, 2013 at 4:07 AM, Eric Dong <ericcesium133 at gmail.com> wrote:
> Hi there,
>
> My Racket GUI application needs to do a lot of cleanup work when exiting,
> i.e. when the user presses the X button. Wrapping the .rkt in a shell
> script which waits and then does the cleanup is a bit too hacky for me.
> There are many exit handlers in the Racket documentation (exit-handler etc)
> but none of them seem to work!
>
> Thanks a whole ton!
>
> Yuhao Dong
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130908/4bfb6bc2/attachment.html>