• 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: Subclassing NSDocumentController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSDocumentController


  • Subject: Re: Subclassing NSDocumentController
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Mon, 12 Jul 2004 20:27:54 -0700

Hello...

Have you actually instantiated the NSDocumentController subclass in your nib (so that there is an object shown in the nib contents window that represents an instance of your class)? After you drag the header file for your subclass to the nib window, it should show the class browser with your subclass selected. Then all you have to do is go to the "Classes" menu in the menu bar and choose "Instantiate" and an instance of your sublcass will be created in the nib.

The first instance of NSDocumentController or a subclass that is created becomes the shared document controller for the application, so when there is an instance in the MainMenu.nib (or whatever the main nib is set to be in your Info.plist) it will be used and the application will not create another one.


Hope that helps,

Louis


I need to override the openDocument and newDocument methods in
NSDocumentController. I have created a class called FileHandler which is a
subclass of NSDocumentController with the new methods and some additional
instance variables.

Now that I have done this I want FileHandler to be the First Responder for
my MainMenu.nib so that when the user selects Open or New, the new methods
are called.

I have dragged the FileHandler.h file into the MainMenu.nib, but how do I
make this subclass act as the first item in the responder chain ahead of
NSDocumentController?


--
____________________________________________________________
Bruce E. Truax email: email@hidden
_______________________________________________
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.


  • Follow-Ups:
    • Re: Subclassing NSDocumentController
      • From: Bruce Truax <email@hidden>
References: 
 >Subclassing NSDocumentController (From: Bruce Truax <email@hidden>)

  • Prev by Date: Subclassing NSDocumentController
  • Next by Date: Re: Determining if a method is a class or instance method
  • Previous by thread: Subclassing NSDocumentController
  • Next by thread: Re: Subclassing NSDocumentController
  • Index(es):
    • Date
    • Thread