Not able to catch EVT_CLOSE in mac when app is closed from DOC
-
- Earned a small fee
- Posts: 12
- Joined: Fri Sep 11, 2015 6:24 am
Not able to catch EVT_CLOSE in mac when app is closed from DOC
I am facing a problem in handling close event in MAC. I am catching EVT_CLOSE in my frame and do few things.
this event is caught when I press X button or closing the app from task bar in windows but in MAC this event
is caught only when I press X button of app not when it is closed from DOC buy using force quit.
Any idea how can i catch close event in this situation?
this event is caught when I press X button or closing the app from task bar in windows but in MAC this event
is caught only when I press X button of app not when it is closed from DOC buy using force quit.
Any idea how can i catch close event in this situation?
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
I don't much about OS X, but if that "force quit" is the same as killing the process through the task manager under Windows, there is no way to catch that.
You could try to catch the wxEVT_END_SESSION event, but i have my doubts it will fire in that situation.
http://docs.wxwidgets.org/trunk/classwx ... event.html
You could try to catch the wxEVT_END_SESSION event, but i have my doubts it will fire in that situation.
http://docs.wxwidgets.org/trunk/classwx ... event.html
Use the source, Luke!
-
- Earned a small fee
- Posts: 12
- Joined: Fri Sep 11, 2015 6:24 am
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
Hi,
This gets caught in the App and by this time my frame destructor will be called and some listeners will be detatched. I wanted to catch the event my frame like in case of EVT_CLOSE.
Any idea how can check this in my frame before going for app exit?
This gets caught in the App and by this time my frame destructor will be called and some listeners will be detatched. I wanted to catch the event my frame like in case of EVT_CLOSE.
Any idea how can check this in my frame before going for app exit?
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
Have you tried wxEVT_QUERY_END_SESSION? If it's sent, it should arrive before the frame is destroyed.
Use the source, Luke!
-
- Earned a small fee
- Posts: 12
- Joined: Fri Sep 11, 2015 6:24 am
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
Yes i tried now, But no end query session is not getting handled on quitting from doc, I have another question, Is it possible to make wxApp not quittable for some amount of time when we are doing something in the background?
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
Not that i know of.Is it possible to make wxApp not quittable for some amount of time when we are doing something in the background?
I Googled about what "force quit" on OS X actually does and it seems its purpose is to kill unresponsive apps. If a user does this, he can't complain when the app doesn't exit gracefully.
Does the wxFrame destructor get called if an app gets killed like this? If yes, you could do some of the clean up there.
Use the source, Luke!
-
- Earned a small fee
- Posts: 12
- Joined: Fri Sep 11, 2015 6:24 am
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
Thanks doublemax for your timely help, Sorry for posting my response late.
I found this api OSXOnShouldTerminate. Which is part of out app.cpp. This gets called whenever the application is closed from the doc in mac
I found this api OSXOnShouldTerminate. Which is part of out app.cpp. This gets called whenever the application is closed from the doc in mac
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
Hi,
You can prepare and submit a patch to the trac.wxwidgets.org or make a PR on github.
Then you will guarantee that this function will be in the library and it will be less maintenance for you code.
Thank you.
You can prepare and submit a patch to the trac.wxwidgets.org or make a PR on github.
Then you will guarantee that this function will be in the library and it will be less maintenance for you code.
Thank you.
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
@ONEEYEMAN
It is in wxWidgets, but apparently undocumented.
It is in wxWidgets, but apparently undocumented.
Use the source, Luke!
Re: Not able to catch EVT_CLOSE in mac when app is closed from DOC
@doublemax,
Again - patches welcome.
Again - patches welcome.