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/