cocoa-bindings

Implementing a KVO/Bindings-Compliant Bridge-Pattern in Cocoa

Hi folks, I'm trying to implement a simple object bridge in cocoa where the bridge object acts as a kvo/bindings-compliant drop in for some arbitrary other NSObject instance. Here is my problem (more details in the code below): A bridge object acts as a drop in for a Person-Object, with an NSString* property called name and an Address...

What's a good way to bind from a shared utility window and the frontmost document window?

I have an application which allows for multiple NSDocuments to be open. In this application is a single utility window that contains some functionality that I want to apply to the frontmost document. I am trying to use bindings here, so the trick is how to cleanly bind the user interface of the utility window to the frontmost document....

Cocoa bindings problem; bound table columns don't show any data, no errors in console

I'm having trouble converting my Cocoa project from a manually-synched interface model to a bindings model so that I don't have to worry about interface glue code. I followed the CocoaDevCentral Cocoa Bindings tutorial to make sure that I had covered all the bases, but things aren't working correctly. I have a master-detail interface, ...

Should I use Cocoa bindings for my latest project?

I'm starting a project which I think would benefit from bindings (I've got a source list table, several browser views, etc), but I think it would also be quite doable, and perhaps more understandable, without them. From my limited experience I've found bindings to be difficult to troubleshoot and very "magic" (e.g. it's difficult to inse...

Weird bindings issue

I'm trying to use a browser view with bindings to represent some data and I'm getting an error message: 2008-11-11 17:22:28.636 BrowserViewTest[18269:813] Cocoa Bindings: Error accessing value for key path arrangedObjects.projects of object <NSTreeController: 0x1321e0>[object class: BillingCode] (from bound object <NSBrowser: 0x126930...

Setting the NSBrowserCell image using bindings?

I've got an NSBrowser hooked up to an NSTreeController bound to an array of NSTreeNode objects. It's easy enough to get the text portion working by setting the Content and Content Value bindings to properly reference the tree controller, but how do I set the image for each cell using bindings? ...

How do I keep an NSPathControl updated with the path of the selected cell in an NSBrowser

I need to keep an NSPathControl updated with the currently selected path in an NSBrowser, but I'm having trouble figuring out a way of getting notifications when the path has changed from the NSBrowser. The ideal way to do this would just to be to observe the path key path in the NSBrowser, but that gives a KVO can only observe set<key> ...

MVC and cocoa bindings best practices question

Lets say I have a view, myView, a view controller, myViewController, and some sort of model object, myModel. Further, lets say the model has two KVO compliant properties, arrayOfPeopleNames and arrayOfAnimalKinds (both NSStrings). In my view I want to have two pop-ups bound to the contents of these two arrays. My question is, if myCont...

Is it necessary to override bind:toObject:withKeyPath:options: in an NSView subclass to implement binding?

I have an NSView subclass which has property which I want to be bindable. I've implemented the following in the subclass: myView.h: @property (readwrite, retain) NSArray *representedObjects; myView.m: @synthesize representedObjects; +(void)initialize { [self exposeBinding: @"representedObjects"]; } -(void)bind:(NSString *)bi...

Code review for many-to-many relationship UI implementation in CoreData

Below is the "work horse" piece of code that I've implemented in order to display a many-to-many relationship in CoreData. My UI is on a screen called "Expense". This expense can be associated with many transactions. (Also, transactions can be associated with several expenses). The UI contains the currently selected expense, and a table...

Editable NSTableView with Bindings won't set values in model

Here is my setup. In my application delegate, I have a property called currentFoo. The currentFoo property is set to the currently selected Foo instance. The Foo instances each have a property which is a NSMutableArray called results. The objects in results can be of various types, NSNumber, NSString, etc... I have an NSTableView that...

How to create a binding for NSApp.dockTile's

In IB it is easy to bind a label or text field to some controller's keyPath. The NSDockTile (available via [[NSApp dockTile] setBadgeLabel:@"123"]) doesn't appear in IB, and I cannot figure out how to programmatically bind its "badgeLabel" property like you might bind a label/textfield/table column. Any ideas? ...

How do I make the value binding of NSTokenField supply an NSString?

I have replaced an NSTextField with an NSTokenField so that I can perform some auto-completion. The value of the NSTextField was bound to a NSString attribute of a controller class. Now that I have changed the NSTextField to an NSTokenField the value has changed to an NSArray. How do I make the NSTokenField value binding be an NSString...

Using one NSArrayController from multiple XIBs

I'm having some problems displaying the contents of one NSArrayController in two windows defined in different XIBs. In my main window (in MainMenu.xib), I have an NSTableView which is bound to an NSArrayController In my second XIB, I have another window that contains an NSTableView. I created a new NSArrayController, and bound the tabl...

Remove correctly selected NSManagedObjects

Look at this great screenshot and I think you can imagine what I could ask... The players: to the right: the preferences-panel and a NSTableView to the left: main-window with a NSPopUpButton (under the NSMenu ;] ) The selected object of the popup is binded to one of these in the tableview. This ugly thing (what you can see th...

observeValueForKeyPath:ofObject:change:context: doesn't work properly with arrays

I have an object that implements the indexed accessor methods for a key called contents. In those accessors, I call willChange:valuesAtIndexes:forKey: and didChange:valuesAtIndexes:forKey: when I modify the underlying array. I also have a custom view object that is bound to contents via an NSArrayController. In observeValueForKeyPath:of...

Is it possible to bind the null placeholder in Cocoa?

I have a table where certain cells will be nil until the user fills them in, but I was hoping that I could change the null place-holder (i.e. the value it displays when the particular value for that cell is nil) depending on other parts of the application the user has already filled in or configured. Sort of like an auto-complete but not...

Binding two different model-key-paths to the same NSArrayController selection

Say I have the following array of dictionaries: { { isoName => en, fullName => English, localName => English }, { isoName => de, fullName => German, localName => Deutsch }, { isoName => fr, fullName => French, localName => français } } How ...

What describes objective-C and Cocoa Bindings best?

I have trouble understanding Cocoa Bindings. Can someone explain me what this is all about, in an way that is humanly perceivable? ...

What does "Controller Key" mean in Interface Builder > Inspector > Bindings?

I can't find in the Docs where they explain all those fields and what they mean. Especially "Controller Key" is not clear to me. ...