• 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
Need help with document, window controllers and bindings.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need help with document, window controllers and bindings.


  • Subject: Need help with document, window controllers and bindings.
  • From: Nelson Santos <email@hidden>
  • Date: Mon, 15 May 2006 22:06:00 -0700

Hi all,

I'm stuck and I can't seem to think my way out of it.  Can anyone help?

Classes info:

A) My app has an NSDocument subclass named UniverseDocument. It implements makeWindowControllers which sets up one window controller.
B) My app also has an NSWindowController subclass named UniverseWindowController. This is the window controller that is added to the document's window controllers mentioned in (A).
C) My app also has another NSWindowController subclass named DesignWindowController. This window controller is instantiated and added to the documents window controllers when the user clicks on a button located in the window controller mentioned in (B).


How app works:

My app basically works like this: It is a multiple document program. Upon loading, the UniverseWindowController loads a nib file which consists of a window, a large NSTableView and an add button. When the user clicks on the add button, the DesignWindowController gets instantiated and loads and displays the Design nib. The user inputs the data into the design nib. When the user clicks on the save button in the nib, the design window closes and it is supposed to add a new record to the table control in the universe window.

My problem:

The problem is, I don't know how to link all the objects involved. This is what I am thinking:
1) An NSMutableArray object should live in my UniverseDocument object.
2) The save button in the design nib should call the save action method located in the DesignWindowController.
3) The save action method should send the underlying data to the UniverseDocument to be added to the mutable array there.
4) The design window should close.
5) The table control in the universe nib should be updated to show the new record that was just added to the mutable array.


Numbers 1, 2 and 4 are no brainers.  How do I get 3 and 5 working?

What's confusing me:

i) I tried to add an array controller to the Universe nib, but I don't know how to bind it to the mutable array located in my UniverseDocument.
ii) I can add a new object to the mutable array in the document object from the save method in the DesignWindowController easily enough, but I don't know how to make the table control reflect the updated data set.
iii) Should I instantiate an NSMutableArray in the Universe nib? I figure no, because the data should exist in my model object (UniverseDocument).
iv) I don't want to have the mutable array object living in the UniverseWindowController object, because it really should live in the UniverseDocument object.


Getting dizzy...  Help!

Thanks!
Nelson

_______________________________________________
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: Need help with document, window controllers and bindings.
      • From: Lon Giese <email@hidden>
  • Prev by Date: Re: CGDisplayFade maximum length in seconds?
  • Next by Date: Re: incompatible pointer type warning, but everything OK?
  • Previous by thread: Fwd: CGDisplayFade maximum length in seconds?
  • Next by thread: Re: Need help with document, window controllers and bindings.
  • Index(es):
    • Date
    • Thread