nsarraycontroller

How can I create a master-detail interface with Core Data and an abstract entity?

Apple has a nice little tutorial for making a simple master-detail interface. Interface Builder will even automatically generate one for you from a Core Data entity. However, I'm trying to do something more complicated than the simple example and I've been struggling for a while to get it to work. I have a Core Data document-based appli...

NSArrayController initialization

I am having trouble getting an core-data backed NSArrayController to work properly in my code. Below is my code: pageArrayController = [[NSArrayController alloc] initWithContent:nil]; [pageArrayController setManagedObjectContext:[self managedObjectContext]]; [pageArrayController setEntityName:@"Page"]; [pageArrayController s...

Objects removed from NSArraycontroller stay in table until clicked

I have an NSArraycontroller which is bound to my application's AppDelegate's managedObjectContext. It acts as a download queue. Items are added to the NSArraycontroller programmatically I have a table which shows two of the fields in this, each a column with its value individually bound to the the said NSArraycontroller. When a new down...

How do I perform an action in response to an item being added to an NSArrayController's content?

Hello, I have an NSArrayController whose content is the "servers" property of my AppDelegate. I have an NSTextField which is bound to the "selection.name" property of the NSArrayController and I have buttons attached to the "add:" and "remove:" actions on the NSArrayController. What I'd like to see happen, is when I click the "Add" bu...

Core data and custom NSCell

I am building a toy app using core data for two entities Log (attributes text and date) and Tag with a many-to-many tags relationship from Log to Tag. I want to show logs in a table, so I: created an NSArrayController instance, LogController in IB with entity set to Log (pic) created a one-column NSTableView whose column is bound to ...

Bindings - master detail array controllers

I really hope someone can help on this because I'm learning cocoa and have hit a road block. I am trying to model a simple poker tournament. For now, my entities are simply a Tournament (with a number) and a Player (with a Name). A Tournament has an array of Players. I can bind two independent table views to display the tournaments a...

Table view not updating according to bindings - Part Deux

Title borrowed from this question, of which this one is not a duplicate. See my answer there for what was wrong for that questioner; I'm the author of that answer, and my problem is not that one. I have a table view with three columns, whose Value bindings are bound to three properties of the arrangedObjects of an array controller. The ...

Using Array Controllers to restrict the view in one popup depending on the selection in another. Not core data based.

I am working on an app that is not core data based - the data feed is a series of web services. Two arrays are created from the data feed. The first holds season data, each array object being an NSDictionary. Two of the NSDictionary entries hold the data to be displayed in the popup ('seasonName') and an id ('seasonID') that acts as a p...

Displaying row index in an NSTableView bound to NSArrayController

I have an NSTableView which is bound to an NSArrayController. I would like to have one of the table columns showing the index of the table row. This is easy enough to do when you implement NSTableDataSource yourself but I can't figure it out with a bound table view. I guess I'm looking here for something like the @count key path which gi...

NSArrayController addObject Returns null

I have a core data application with two NIBs, the main window with a pair of NSTableViews and a form for adding content. The form has an NSTextView and an NSTextField. I have two entities in core data, and manage the content with two NSArrayControllers. With one NSArrayController, the following code in my AppDelegate works fine for ad...

NSManagedObjectContext and NSArrayController reset/refresh problem

I'm having trouble getting my UI to reflect external changes (made by another process) to an sqlite data store. I have a fairly standard core data based NSArrayController / table view. My app gets notified that external changes have been made to the data, at which point I do a [managedObjectContext reset]; // brute force, but data set ...

Deleting a object NSArrayController

I have a NSTableView which gets it's data from a NSArrayController and I need to delete the currently selected row, I know NSManagedObjectContext has a delete deleteObject: method but I can't think of how to deleted it from the NSArrayController? ...

NSArrayController and KVO

What do I need to do to update a tableView bound to an NSArrayController when a method is called that updates the underlying array? An example might clarify this. When my application launches, it creates a SubwayTrain. When SubwayTrain is initialised, it creates a single SubwayCar. SubwayCar has a mutable array 'passengers'. When a ...

NSArrayController "Content set" bound to NSTreeController issue

I have an NSOutlineView bound to a NSTreeController and a CoreData Datamodel. NSOutlineView displays his data properly. A NSTableView's cell values bound to a NSArrayController, displaying data from CoreData. NSTableview displays his data properly too. The Datamodel has a relationship between data for NSOutlineView and NSTableView W...

How does NSTableView modify the selection of NSArrayController via bindings?

Let's say I have the following situation: When I select different rows in the NSTableView, it magically updates the NSArrayController (PersonController) selection. How is the NSTableView doing this? Does it do something like this: - (void)bind:(NSString *)binding toObject:(id)observableController withKeyPath:(NSString *)keyPath optio...

Cocoa binding to single object from an array

I previously posted this question as a comment on a related thread thinking it was simple. That thread is here: http://stackoverflow.com/questions/670202/cocoa-binding-to-a-particular-item-in-an-array-controller/2082309#2082309 The questions relates to (and I'll more fully describe it here) a game I'm building to try and learn objec...

Doing something wrong with bindings, can't find out what

Hi, I've a mutable array that holds instances of a model object. That model object has several properties one being "name". I have no problems initialising or populating the mutable array. I've a window with a drawer. I added a table to the drawer, the idea being that the drawer would use the table to display several instances of the m...

How expensive is it to retrieve a model object from an nsarraycontroller?

I've a window with a table. The table lists several model objects by name. Those model objects back a window and that window's components all depend on the model objects for their values. Some tables on that window cannot be bound to the model object and must be populated using a data source. In this situation I retrieve the currently s...

NSArrayController creating, modifying and then selecting a new object

The main view of my NSPersistentDocument based application is a table view (bound to an NSArrayController) showing the list of records, below it there is an "add record" button. I want the button to cause the following (supposedly trivial) behavior. Create an new object Set some defaults to the new object (that are stored in the main ...

How to programatically setObjectClass for NSArrayController

I'm having a problem with what should be a very simple thing. I want to create an NSArrayController and specify the class it manages. Problem is, I can't figure out the correct way to specify the Class in the setObjectClass method. I want to do the following: [projectArrayController setObjectClass:SKHProject]; SKHProject is a class...