Re: Trapping the close click?
Re: Trapping the close click?
- Subject: Re: Trapping the close click?
- From: Dustin Voss <email@hidden>
- Date: Fri, 30 May 2003 00:38:57 -0700
On Wednesday, May 28, 2003, at 07:46 AM, Ryan Stevens wrote:
On Wednesday, May 28, 2003, at 06:27 AM, Matthew Weinstein wrote:
Does anyone out there know if there is a way to "trap" the close
click, i.e., have it send a message to something other than
performClose?
This should work...
id closeButton = [yourWindow standardWindowButton:NSWindowCloseButton
];
[closeButton setAction:@selector(yourActionMethod:)];
[closeButton setTarget:self];
Standard warning: Be careful not to "break" it. Everyone expects that
clicking the close button will close the window. ;-)
That's assuming you weren't really looking for
NSWindowWillCloseNotification.
I think there's an undocumented "_close:" method implemented by
NSWindow. Perhaps you could write an NSResponder sub-class to catch it
and do something. You'd instantiate the responder and insert it into
the responder chain above the window's content view.
But I like Ryan's solution better.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.