In article <7791207D-C57A-4932-8E04-DCDB577CAC41%schlueter@[EMAIL PROTECTED]
>,
Martin Schlueter <schlueter@[EMAIL PROTECTED]
> wrote:
> Hi
>
> I'm not an expert in programming but I managed to build a CoreData
> application and enhanced it with some AppleScript. My app has only one
> window and from time to time my user manages to close the window and
> has no way of re-opening it (apart from quitting and restarting).
>
> I see two possibilities to get around this:
>
> 1.)
> My app could open the window when activated again (as Mail,
> iTunes, ... does)
>
> 2.)
> My app could quit when the windows closes.
3. You could provide an explicit menu command for the user to invoke to
reopen the window, as Mail and iTunes do. But that's just another way to
invoke the underlying functionality you're talking about in point #1.
Whether the application should quit automatically or not when the last
window closes is very app-specific and more than a little subjective.
It's a behavior that should generally be adopted by very single-purpose
tools that in a prior life might've been implemented as desk accessories
for example. Something where closing the window is a very clear signal
that the user is "done."
> So far I have no idea how to manage this. In the "currency converter"
> tutorial I found the following event handler
>
> on should quit after last window closed theObject
> return true
> end should quit after last window closed
>
> I added the handler to the AppleScript and linked it with the event in
> Interface Builder. But this doesn't work, the event handler is not
> even called.
What object did you link it *to*? I've only done the briefest of
dabbling with AppleScript Studio, but for Cocoa that handler will only
be triggered if it's implemented by an object that's designated as the
delegate for the application. It wouldn't be something that, for
example, you associate with a window.
G


|