Re: macOS: No WM_DELETE_WINDOW protocol when using "Quit app"?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: macOS: No WM_DELETE_WINDOW protocol when using "Quit app"?
De : user2230 (at) *nospam* newsgrouper.org.invalid (nab)
Groupes : comp.lang.tcl
Date : 22. Feb 2025, 18:15:07
Autres entêtes
Message-ID : <1740244507-2230@newsgrouper.org>
References : 1
User-Agent : Newsgrouper/0.7.0

Torsten <Torsten@example.com> posted:

The close icon triggers a WM_DELETE_WINDOW protocol, but not the menu entry "Quit app".
I use this to register my own exit handler for my app.
How can I call my own exit handler when the user closes the app via "Quit app"?
 
Torsten
 

Hi,
in my app I do like that:
#ifndef HAVE_COCOA
    Tcl_EvalEx(x->interp, "wm protocol . WM_DELETE_WINDOW {exit}", -1, TCL_EVAL_DIRECT);
#else
    Tcl_EvalEx(x->interp, "wm protocol . WM_DELETE_WINDOW {::tk::mac::Quit}", -1, TCL_EVAL_DIRECT);
#endif

and I have an exit proc:
proc exit {} {
#do what you want
}

++
Nicolas

Date Sujet#  Auteur
22 Feb 25 * macOS: No WM_DELETE_WINDOW protocol when using "Quit app"?3Torsten
22 Feb 25 +- Re: macOS: No WM_DELETE_WINDOW protocol when using "Quit app"?1nab
22 Feb 25 `- Re: macOS: No WM_DELETE_WINDOW protocol when using "Quit app"?1Robert Heller

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal