Override Exit

Environment: QNX 6.2
Tool: PhAB

When someone clicks on the exit box in the upper right hand corner of the
window the program will exit. How can I intercept this signal to do some
housekeeping before the program officially exits?

Best Regards

–Elmer Thomas

Elmer Thomas wrote:

Environment: QNX 6.2
Tool: PhAB

When someone clicks on the exit box in the upper right hand corner of the
window the program will exit. How can I intercept this signal to do some
housekeeping before the program officially exits?

Best Regards

–Elmer Thomas

try to place your housekeeping into “Window Closing”-callback from the
“Callbacks” panel group to the left of your canvas

mirtch <mirtch@gmx.net> wrote:
: Elmer Thomas wrote:

:> Environment: QNX 6.2
:> Tool: PhAB

:> When someone clicks on the exit box in the upper right hand corner of the
:> window the program will exit. How can I intercept this signal to do some
:> housekeeping before the program officially exits?

:> Best Regards

:> --Elmer Thomas

: try to place your housekeeping into “Window Closing”-callback from the
: “Callbacks” panel group to the left of your canvas

See also “Notification callback” in the Window Management chapter of the
Photon Programmer’s Guide. There’s even some sample code that you might
find useful.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Steve Reid <stever@qnx.com> wrote:

mirtch <> mirtch@gmx.net> > wrote:
: Elmer Thomas wrote:
:> When someone clicks on the exit box in the upper right hand corner of the
:> window the program will exit. How can I intercept this signal to do some
:> housekeeping before the program officially exits?

: try to place your housekeeping into “Window Closing”-callback from the
: “Callbacks” panel group to the left of your canvas

Caveat: the Window Closing callback (just like the Unrealized callback)
happens every time the window is unrealized. In general, a widget can
be realized and unrealized more than once. A DESTROYED callback is
safer – it’s impossible for it to be called twice for the same widget.

(Currently, the only way for a widget to be unrealized and then realized
again is by calling PtUnrealizeWidget() and PtRealizeWidget() from your
code. But if we ever resurrect the “jumpgate” mechanism that we had in
Photon 1.xx, it will be possible for a window to get unrealized and then
re-realized even if your code doesn’t explicitly ask for it. And you
probably don’t want to confuse that with your application being
terminated.)

See also “Notification callback” in the Window Management chapter of the
Photon Programmer’s Guide. There’s even some sample code that you might
find useful.

That’s a bit more complicated, but allows you to prevent the window from
being closed.