• 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
Document-based app - creating independent floating window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Document-based app - creating independent floating window


  • Subject: Document-based app - creating independent floating window
  • From: Andrew White <email@hidden>
  • Date: Fri, 29 Oct 2004 13:32:45 +1000

Situation:

I have a document-based app which has multiple text-entry document windows. I want to creating a separate floating palette which when its buttons are clicked will insert text into the current main document window.

In case anyone recognises it, the document app is "MathPaper" from "Building Cocoa Applications: A step-by-step guide" and I'm trying out exercise 4 on pg 389.


At present, I have 3 nibs:

MainMenu.nib - contains just the main menus, including a 'View -> Keypad' menu (the keypad is the floating window). No associated custom classes.

MathDocument.nib - contains the code to handle the document windows. Associated custom classes include children of NSDocument and NSWindowController.

Keypad.nib - contains a panel with two matrices of buttons.


Questions:

(1) How does NSDocumentController (the first responder for the main menu) know to instantiate MathDocument.nib (rather than some other NSDocument)?


(2) In order to display the keypad, I figure I'm at some point going to need to call [NSBundle loadNibNamed: @"Keypad.nib" owner: <owner> ]. Where does this call go? How do I link the 'keypad' menu item to the code that contains this call? Do I subclass NSDocumentController or is there a better place?


(3) Finally, considering that the Keypad is in a different nib to the document window, how do I get connect the keypad button press to the main window? For now, I simply want the name of the button entered into the main window.

Currently, the button press messages go to a keypad controller, which then needs to pass them on to the main window. How (and who) do I ask to find the identity of the main window?

Would it be easier to send a special message to the first responder?


I can understand each individual component, but Cocoa glue code is somewhat overwhelming without guidance, and I've not been able to find a good walkthrough in the included Apple documentation.

--
Andrew White
_______________________________________________
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
  • Follow-Ups:
    • Re: Document-based app - creating independent floating window
      • From: James Spencer <email@hidden>
  • Prev by Date: Re: KVO of nested objects
  • Next by Date: Framework and Prebinding
  • Previous by thread: NSMatrix and selecting ranges with setSelectionFrom
  • Next by thread: Re: Document-based app - creating independent floating window
  • Index(es):
    • Date
    • Thread