Lisp HUG Maillist Archive

How to quit

I'm writing a CAPI application that reads a data file and displays it  
in a document window to allow you to edit it.

I've defined a confirm-destroy-function for the interface that  
prompts the user to save any changes before closing the document  
window, and that works fine.

However, when testing the application under the LispWorks IDE,  
choosing Quit from the LispWorks window seems to close my document  
window without respecting the confirm-destroy-function.

Is there something I'm doing wrong? Or do I need to add actions to  
the LispWorks "When quitting image" action list to do a destroy- 
interface on my document window?

Thanks for any advice,
David Johnson-Davies

+------------------------------------------------------------+
David Johnson-Davies, Human-Computer Interface Ltd
17 Signet Court, Swanns Road, Cambridge, CB5 8LA, England.

Tel: +44 1223 314934, Fax: +44 1223 462562
Email: david@interface.co.uk, Web: http://www.interface.co.uk/
+------------------------------------------------------------+


Re: How to quit

On Fri, Feb 26, 2010 at 10:40 AM, David Johnson-Davies
<david@interface.co.uk> wrote:
> I'm writing a CAPI application that reads a data file and displays it in a
> document window to allow you to edit it.
>
> I've defined a confirm-destroy-function for the interface that prompts the
> user to save any changes before closing the document window, and that works
> fine.
>
> However, when testing the application under the LispWorks IDE, choosing Quit
> from the LispWorks window seems to close my document window without
> respecting the confirm-destroy-function.
>
> Is there something I'm doing wrong? Or do I need to add actions to the
> LispWorks "When quitting image" action list to do a destroy-interface on my
> document window?

Capi:destroy ignores the confirm-destroy-function, and
capi:quit-interface is permitted to (with a :force argument).  I was
going to suggest that, since both capi:destroy and capi:quit-interface
use capi:destroy, an :around method on capi:destroy might be an easy
way to get what you want, but it doesn't work (I tried).

I think that you were on the right track with the action lists, but
even better than "When quitting image" would be the "Confirm when
quitting image" list.

(This was actually really great timing;  I need to do the same thing
in an application on which I'm working, and this was a good prompting
to find out how.  Thanks!)

Hope this helps, //JT

-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/


Re: How to quit

David Johnson-Davies wrote on Fri, 26 Feb 2010 15:40:42 +0000 18:40:

| I've defined a confirm-destroy-function for the interface that
| prompts the user to save any changes before closing the document
| window, and that works fine.
|
| However, when testing the application under the LispWorks IDE,
| choosing Quit from the LispWorks window seems to close my document
| window without respecting the confirm-destroy-function.
|
| Is there something I'm doing wrong? Or do I need to add actions to
| the LispWorks "When quitting image" action list to do a destroy-
| interface on my document window?

Just call quit in the destroy-callback.

If you plan to deliver your application, another solution is possible. Put
:quit-when-no-windows t in the delivery script. The latter is more
convenient on debug stage as you do not exit the IDE on closing your window.

--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Updated at: 2020-12-10 08:39 UTC