• 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
Closing Windows and canCloseDocumentWithDelegate:...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Closing Windows and canCloseDocumentWithDelegate:...


  • Subject: Closing Windows and canCloseDocumentWithDelegate:...
  • From: Seth Willits <email@hidden>
  • Date: Sun, 8 May 2005 01:11:14 -0700

Me again. I seem to have a lot of fun (ha!) banging into walls in AppKit.


My window controller classes manages multiple documents in a single window so I need to do some custom stuff depending on how many documents are in the window and how many are edited and unedited. I thought I had something figured out that was working great, but in one case it spazzed and I can't see how to fix this. Anyway...


The problem is that clicking the close button in a window or sending it performClose: automatically calls canCloseDocumentWithDelegate... on the window's document. However, since I have multiple documents attached to the window controller, I need these two actions to ask the window controller what to do _first_.

The only way I can see how to work around this is to override canCloseDocumentWithDelegate to call a special method on the window controller that runs some custom code, and then if it needs to show the standard save changes sheet, call a special method in the document class (runCloseDocumentSheetWithDelegate or some such thing) which simply calls [super canCloseDocumentWithDelegate...].

What a mess, but it should work.

Is there a better way to go about this?



Seth Willits
----------------------------------------------------------
Freak Software - http://www.freaksw.com/
ResExcellence - http://www.resexcellence.com/realbasic/
----------------------------------------------------------

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Another relationship problem
  • Next by Date: NSMetadataItem question.
  • Previous by thread: Another relationship problem
  • Next by thread: NSMetadataItem question.
  • Index(es):
    • Date
    • Thread