Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Window Controller and performClose




On Apr 30, 2005, at 3:32 PM, Seth Willits wrote:

On Apr 29, 2005, at 10:52 AM, Seth Willits wrote:


I've got a standard document application setup with a custom window controller that does all of the user-interface work. I need to trap the performClose method in the window controller because I have to handle it differently than the sheet automatically popping down asking to save the document or simply closing the window if the document is already saved.

NSWindow's documentation says that if its delegate responds to performClose: then it'll send the message there instead of handling on its own. So I figured that since the window controller is the window's delegate I should be getting the performClose method there and all will be honki dori, but this isn't the case. The performClose method in the window controller is never getting called, and I still see the standard document behavior.



Anyone? I don't want to be a pest but I really don't know why the docs seem to be misleading.


Not quite. The delegate gets sent -windowShouldClose: ...

---------------------------------------------------------------

performClose:
- (void)performClose:(id)sender

This action method simulates the user clicking the close button by momentarily highlighting the button and then closing the window. If the receiver’s delegate or the receiver itself implements windowShouldClose:, then that message is sent with the receiver as the argument. (Only one such message is sent; if both the delegate and the NSWindow implement the method, only the delegate receives the message.) If the windowShouldClose: method returns NO, the window isn’t closed. If it returns YES, or if it isn’t implemented, performClose: invokes the close method to close the window.
If the receiver doesn’t have a close button or can’t be closed (for example, if the delegate replies NO to a windowShouldClose: message), the system beeps.


See Also: – styleMask, – performMiniaturize:

---------------------------------------------------------------



Darkshadow (aka Michael Nickerson)



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Window Controller and performClose (From: Seth Willits <email@hidden>)
 >Re: Window Controller and performClose (From: Seth Willits <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.