On Mar 3, 2010, at 7:20 AM, Eric Gorr wrote: >> Otherwise, you can make your class implement the NSWindow delegate method >> -windowShouldClose:, which will also be called when the user tries to close >> the window. > > This method is called after I press the close (red) button. My only concern > here is that the method does not necessarily lend itself to be exclusively > called at this time and it would be a problem if it was ever called if the > window was being closed for any other reason.
No offense, but why do you need to distinguish between these? It might be a bad user interface design — for example, have you considered that some disabled users have trouble with precise gestures and use keyboard equivalents whenever possible? I can assure you that -windowShouldClose: is only called in response to direct user interaction, and is often used to put up a confirmation sheet. > So, how certain is it that it will _only_ be called if the user presses the > close (red) button? It's also called if the user chooses the Close menu command or presses Cmd-W. > With the old toolbox, one would receive a mouse down event and be able to > determine what window and what part of the window it belonged to. One of > these parts was "inGoAway". I just need the same information with the same > reliability. You could examine [NSApp currentEvent] and see if it's a mouse event, if you really need to know. —Jens_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com