• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWindowController that closes itself, revisited
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindowController that closes itself, revisited


  • Subject: Re: NSWindowController that closes itself, revisited
  • From: Dan Bernstein <email@hidden>
  • Date: Mon, 19 Nov 2001 16:56:18 +0200

On Wednesday, November 14, 2001, at 05:08 AM, Erik M. Buck wrote:

I'm writing a NSWindowController subclass (but not one to be used for a
NSDocument). I've made it the NSWindow delegate for its window as well.

Now, when the user closes the window, being the NSWindow delegate I get
a windowWillClose, and I handle it by sending a message directly to some
object and then doing [self autorelease].

Under certain conditions, I would like to initiate the same process
myself, from within my NSWindowController subclass. I tried [[self
window] performClose:self], but when I do that, my windowWillClose
doesn't get called!

Why is that, and what should I do to overcome this?

It is probably that way because if you send a message to close the window
you probably want it to close.

Well, actually, most of the times I send a message to close the window, a NSWindowWillCloseNotification is posted and the delegate receives a windowWillClose: message. In fact, this happens even when I send a close message to the window (and not a performClose:). However, in that particular spot in my code, although I send a performClose: (or a close) to the window, and _although the NSWindowWillCloseNotification IS posted_ as expected, and although the window's delegate is properly set, the delegate doesn't receive the windowWillClose: message.

I think it's a bug. I'm sure it's inconsistent, and I'm pretty sure it's not documented.

If you have any new thoughts on this, I'd love to hear them.

--
Dan Bernstein


References: 
 >Re: NSWindowController that closes itself (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Launching Application with arguments
  • Next by Date: Database Interaction-help!!
  • Previous by thread: Re: NSWindowController that closes itself
  • Next by thread: global automation, anyone?
  • Index(es):
    • Date
    • Thread