• 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
NSArrayController on multi-window Document-based app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArrayController on multi-window Document-based app


  • Subject: NSArrayController on multi-window Document-based app
  • From: Hal Mueller <email@hidden>
  • Date: Fri, 9 Mar 2007 12:08:26 -0800

I am trying to change a Document-based app from having one kind of window, and no NSWindowController, to having several kinds of windows (and perhaps multiple instances of some of the kinds). This is for a graphics viewing app, where each graphic object is defined by a file on disk.

I want one composition window, where the user chooses which graphic objects/graphic files are loaded, and one or more display windows, which display the graphic objects using various perspectives.

The composition window looks a lot like the RaiseMan example in the Hillegass book, with an NSTableView which is meant to be bound to the MyDocument's array of graphics objects. The difference is that in my app, the entries in this table are all derived from the file on disk. When the user clicks an Insert button on that window, I use my own method -insertNewGraphicsObject:sender, which inserts a new object into the window's NSArrayController, pops up a file selection panel, sets the new object's filename, and tells the new object to load itself from disk.

When I had a single window, and no subclassed NSWindowController, this worked fine, and the mutable array of graphics objects in the MyDocument instance was updated. But now that I have split things into multiple classes, I can't figure out how to get the NSArrayController, the NSTableView, and the NSMutableArray in the MyDocument instance to communicate.

What I am seeing is that the window's NSArrayController accumulates the graphic objects, which are loading correctly, but the MyDocument instance's NSMutableArray does not get updated. I think there is a binding that I have missed, or a connection that I didn't make--or maybe I am screwing things up by using my own -insertNewGraphicsObject:sender instead of the standard -insert method. What did I miss?

Here's a summary of the object graph:

MyDocument has an NSMutableArray of graphics objects
CompositionWindowController is defined, and is linking up correctly with MyDocument (-addController puts the controller on the document's list of controllers and sets the document as the CompositionWindowController's document).
In the composition window, I have an Insert button, an NSArrayController, an NSTableView. The window's delegate is the CompositionWindowController, a subclass of NSWindowController. File's owner has outlets defined and connected for the array controller, the table view, and the window.


I tried binding the NSArrayController's contentArray to document.graphicsLayers; that made no difference.

TIA,
Hal

--
Hal Mueller email@hidden Mobile Geographics LLC http://www.mobilegeographics.com/
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSArrayController on multi-window Document-based app
      • From: Hal Mueller <email@hidden>
  • Prev by Date: CoreData Questions: Solved
  • Next by Date: Re: Multi-threaded help
  • Previous by thread: CoreData Questions: Solved
  • Next by thread: Re: NSArrayController on multi-window Document-based app
  • Index(es):
    • Date
    • Thread