Re: How a window was closed?
Re: How a window was closed?
- Subject: Re: How a window was closed?
- From: Scott Ribe <email@hidden>
- Date: Wed, 03 Mar 2010 15:59:05 -0700
- Thread-topic: How a window was closed?
> 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.
You're taking over the close button's responsibilities, but not doing
everything it does.
Start with:
NSButton *b = [[self window] standardWindowButton: NSWindowCloseButton];
closeSel = [b action];
closeTarget = [[b target] retain];
[b setAction: @selector( loggedClose: )];
[b setTarget: self];
Then in your close handler:
// do whatever you need to do in addition to the normal close here
NSButton *b = [[self window] standardWindowButton: NSWindowCloseButton];
[b setAction: closeSel];
[b setTarget: closeTarget];
[[self window] performClose: sender];
[closeTarget autorelease];
It's generally an awful thing to do, but I had to debug some issues around
window closing...
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
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