cocoa-bindings

Cocoa : Refresh NSObjectController after unarchiving Data from disk.

I have an Object bound to the user interface with a NSObjectController. I am able to archive the Object and unarchive it later. This works fine so far. In the Debugger I can see the object holds the data I saved in a previous session. The remaining problem is: The user interface does not refresh. I guess I have to tell the NSObjectContr...

Fetch data by date range using Interface Builder

I have an NSTableView that is done using the typical IB and data bindings. It works well. However I need to put in a Segmented Control to indicate date range. So for example, if user clicks on the "Last Year" segmented control button, the table should only display records for last year. I looked at the data binding options in IB for th...

Updating Value in Core Data

Hi all, I'm trying to write a simple stock check program, and I have a Table View binded to Core Data. The table has 3 columns: Model, Price and Quantity In Stock. I have a NSTextField and a NSButton underneath this, so that the user can enter the quantity they wish to buy, and when they click "add to cart", the program should fetch the...

What's the cleanest way to bind enumerated properties?

I have a menu which has an item for each value in an enum. The menu: [ ] Sort by Due Date [ ] Sort by Priority [√] Sort by Title The enum: typedef enum CW_TASK_SORT_METHOD { CWTaskSortMethodDueDate, CWTaskSortMethodPriority, CWTaskSortMethodTitle } CWTaskSortMethod; The property: @property(readwrite, assign) CWTaskSo...

How would an iTunes-style Source-List be implemented with Bindings+CoreData in Cocoa?

Let's say, for illustration, I was writing an iTunes clone app in Cocoa, that was backed by CoreData. For simplification's sake, let's say there are two "sections", "Library" with things like Music, Movies, Radio, etc. And a second section called "Playlists" which holds user-generated playlists (just dumb lists, not smart playlists). So...

Carbon in Cocoa Crashing: EXC_BAD_ACCESS after NSAutoreleasePool is released

I'm developing a Cocoa user interface for a Photoshop CS3 plugin using Bindings. (Carbon in Cocoa, since PS is a Carbon app) I'm getting a EXC_BAD_ACCESS error when I close my modal NSWindow and the NSAutoreleasePool releases. I believe it has something to do with bindings and the control views I have in my nib file, because when I re...

Implementing parent->child drill down in Cocoa with Core Data bindings that span multiple entities

I'm trying to create a simple interface to my core data model in the style of iTunes Genre browser. I have a model setup with three entities: Genre <-->> Artist <-->> Album. I'd like to simply tie them each to a NSTableView, but it appears as though accessing children relationships from a NSArrayController is not KVC compliant. So, I'...

Cocoa Core Data newbie how-tos

Hi everyone, I am one of the great unwashed masses of .NET developers keen to try their hands at Mac OS X development. At the moment I am trying to figure out the various elements of Cocoa and getting a bit stuck on Core Data. I noticed most of the documentation and resources available on the Web involve a broad end-to-end tutorial, be...

Cocoa binding with @sum value of child

I'm trying to have a table column to display the sum of child values using the IB. I'm not sure if this is doable though. So I have my Core Data bind to a table and a column of "total sales amount" that should be a total of the sales of the parent object. I'm trying to do it like this: "[email protected][email protected]...

Interface Builder won't connect button, but the tutorial says it should work...

I've been trying to learn Core Data, and browsing through questions on Stack Overflow lead me to a recommendation that I try the tutorial on Core Data over at Cocoa Dev Central (Link). Everything is making sense so far in the tutorial, but when I got to step 16, it wouldn't let me connect the + button to the Posts array controller. I'v...

Notifying cocoa bindings system when code changes a property by instead of the interface

I'm writing a countdown timer and instead of calling -[NSTextField setDoubleValue:secondsRemaining] on each tick, I'd like to bind the secondsRemaining property to an interface element via an object controller. The problem with this is that secondsRemaining is modified by code on each tick, not by the interface, so the change is doesn't...

What is the Cocoa Touch equivalent to NSArrayController?

Been starting to work with Core Data a bit, and while I've figured out how to use it in regular Cocoa applications, it seems it works a bit differently in Cocoa Touch. How do you bind entities to objects such as table cells in Cocoa Touch? ...

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...

Calling up a specific record in Core Data

I'm setting up an edit window for a player to edit his user data. I've got all of the fields on the edit form bound to the appropriate Core Data entity (via an NSArrayController), and I've got an awakeFromNib method installed to handle calling the record, but I'm not sure what to put inside the method to get the record to display. Ulti...

Tinkering under the hood with Bindings in Xcode

Let's take two Core Data entities, set up as follows: Entity A: Car Attributes: year model Relationships: manufacturer (<<-> Manufacturer) Entity B: Manufacturer Attributes: name country Relationships: cars (<->> Car) Now, what I want to do is bind the display to an NSTableView where we have the model of th...

Making a table's display dependent on the selection in another table in Interface Builder

I've got a window set up with two NSTableViews. In Core Data I have two entities set up, one of them containing members of the other, larger grouping (e.g. cars and manufacturers). I've got entry pages set up for each entity and they play nicely there (no faulting when trying to select from a many-to-one in a drop menu). What I'm tryi...

IKImageView zooming controlled by an NSSlider.

What's the best practice for setting zoom factor of an image within IKImageView via NSSlider? I was able to bind a slider either to zoom in OR zoom out action of an IKImageView. Obviously, what I'd rather see is a single slider controlling both those actions. Best, if image is refreshed after each change of the slider (continuously, eve...

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 ...

Auto-persist removing objects from NSArrayController with CoreData

Hi! I have a NSTableView with one column bound to NSArrayController representing a collection of entities from a NSManagedObjectContext. I also have a "remove" button that is connected to NSArrayController's remove action, and it all works fine - table is showing data, when I click 'remove', the entity gets removed from the table etc. ...

NSOutlineView with Bindings driven by Core Data

I've got an NSOutlineView acting as a source list for my application, and my data model is done with Core Data. I'd like to use bindings (if possible) to glue these things together as follows: I have three main entities in my model, for sake of example let's call them "Stores", "Cars" and "People". My goal is to have the outline view h...