How a window was closed?
How a window was closed?
- Subject: How a window was closed?
- From: Eric Gorr <email@hidden>
- Date: Tue, 2 Mar 2010 18:32:25 -0500
Is there any way to determine how a window was closed?
I need to base what I do on whether or not a window will be closed by the user pressing the close (red) button or some other way.
One thing I did try was:
NSButton *closeButton = [[self window] standardWindowButton:NSWindowCloseButton];
fCloseButtonTarget = [[closeButton target] retain];
fCloseButtonAction = [closeButton action];
[closeButton setTarget:self];
[closeButton setAction:@selector(closeInterceptor:)];
basically, got the close button and attempted to insert my own close action selector which was implemented as:
- (void) closeInterceptor:(id)sender
{
// my stuff here
[NSApp sendAction:fCloseButtonAction to:fCloseButtonTarget from:sender];
}
However, this did not seem to work as I might have expected. My window controller no longer receives the window will close notification, for example.
Any other thoughts?
Thank you.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden