cocoa-bindings

KVO - problem retrieving object from storage and displaying for edition

Hi, I've a problem with KVO and I just can't find out what it is. I have a screen that can be used to edit or create a record. That record is represented by a model object that holds a number of variables of type NSString. The controller for that string has an instance variable to hold the model currently being worked on. When I open ...

Binding an NSColorWell to an NSTextField

I'm attempting to bind an NSColorWell to the NSTextField value and implementing an NSFormatter subclass. The NSColorWell is bound to an ivar in the app delegate which is also bound to the NSTextField. There is an NSFormatter that converts the [NSColorWell color] to a descriptive string. When the UI focus is on the NSTextField, it does...

Cocoa core data self referential interface builder question

Hi there, I'm having trouble understanding how to get the following working in interface builder. I've created a Core Data model class "Person" that has a number of attributes (first name, surname, etc.) and a relationship to other persons (friends). Conceptually this is very simple. However figuring out how to get this working in IB ...

NSTableView, multiple cells and bindings

I'm trying to create a view that's similar to Motion's properties views (screenshot). Each of my property objects contains a definition of the kind of cell it wants to display as. But at the same time, I'd like to use bindings so that values are automatically updated as they can be changed elsewhere. I've tried a few different approach...

How to keep Cocoa bindings working after replacing the target object's instance with another instance of the same type?

I would like to be able to use bindings to keep my GUI synchronized to a dynamically loaded object, but as soon as I replace the object in question with another one of the same type the bindings break and the GUI stops updating. Here's some code to help you understand what I mean: In my interface I have an instance variable to hold the ...

NSArrayController: Failed to create new object

I have strange problem when I try to add new item to NSArrayController. My XIB file have NSView, NSArrayController and two custom buttons (add & remove). I think my bindings are OK. When press "Add" button program raises Exception. I set a breakpoint to objc_exception_throw and locate the problem in [NSArrayController _executeAdd:didC...

Binding NSSlider to NSTextField with nil minValue?

I have an NSSlider bound to a text field to display the value given by the slider. Everything works, but I would like the NSSlider to send "nil" as minValue to the object. For example, I can convert it to nil when saving (to a propertylist): if ([myOb intValue] > 0) [myDict setObject:... forKey:...] But I would like to apply sa...

Help with Key-Value-Observing.

I need a bit of help with KVO, I'm about half way there. What I'm trying to do is trigger a method when something in an Tree Controller changes. So I 'm using this code to register as a KVO. [theObject addObserver: self forKeyPath: @"myKeyPath" options: NSKeyValueObservingOptionNew context: NUL...

Binding to a NSViewController's representedObject

(Abstract: bindings work in code, but not in IB) I have a window managed by a NSWindowController. To the left of the window is a source view. To the right is a table view showing the elements of the currently selected source. I have set up a NSTreeController within my window XIB. I want its contents to be used for the source view. It's...

Beginners Cocoa Binding Question

I just started with Cocoa Binding and I am working on my first application. Many samples and books use the NSArrayController but since I only want to bind a single Object and his properties to some Textfields I used the NSObjectController. I also don't have a document based application. My application is a simple one-window application....

Binding a table column containing NSPopUpButtons

Hello all, I've got a table one column of which uses an NSPopUpButtonCell. Try as I might, I can't seem to figure out the way to properly bind everything the way I want it. Here's what I'm trying to do: I have an NSArrayController plucking items from a managed object context, called 'Field Values'. This is to be used to populate the po...

In Xcode Document App: Why would init method of MyDocument be called twice?

I followed Chapter 8 of Hillegass to implement the RaiseMan application there. Then I decided to follow the same process to implement the code for an exercise in a Cocoa programming class that I am taking, but I got the following very cryptic error message after building and running. Cannot create BOOL from object <_NSControllerObjectPr...

Cocoa-Bindings : Update NSObjectController manually?

In my little cocoa application I have bound the properties of a class to some text fields with help of a NSObjectController. The only problem I have so far: you always have to leave a text field before the NSObjectController updates the class with the current input. This becomes a problem if the user doesn't leave a texfield and clicks ...

NSDictionaryController doesn't seem to observe changes to content dictionary

I must be missing something simple, but I am having some trouble binding a tableView to an NSDictionaryController. Here is a model of my current scheme: TableViewColumn --bindsTo-->DictionaryController.arrangedObjects.(value or key) --bindsTo-->someClass.someClassMember.aDictionary. I've tested the tableView by adding a...

How do I delete an entity when removing it from an array controller?

I have an entity (e.g. Employee) in a managed object model that is related to two other entities (e.g. Department and Team). Both relationships are one-to-many (i.e. an Employee must have one Department and one Team, Teams and Departments have many Employees). The two may or may not overlap (e.g. a team might be made up of employees from...

Core Data, NSTableColumn bindings and custom NSCell

I'm trying to display an array of NSManagedObjects in a NSTableView using a custom NSCell that is able to draw the managed object properly. For that matter, the single column of my NSTableView is binded to the arrangedObjects of a NSArrayController. I'm not using any key paths on the object. I was under the impression that my NSCell s...

Refresh Cocoa-Binding - NSArrayController - ComboBox

Hello in my application I made a very simple binding. I have a NSMutableArray bound to a NSArrayController. The controller itself is bound to a ComboBox and it shows all the content of the NSMutableArray. Works fine. The problem is : The content of the Array will change. If the user makes some adjustments to the app I delete all the it...

NSArrayController without Array

I just realized there are two ways to use a NSArrayController. Bind the Controller to and Array and add objects to the Array. Or don't use any Array at all and add objects directly to the Controller. [racesArray addObject: [[Race alloc] initWithName:@"Human"] ]; Or [myRacesController addObject: [[Race alloc] initWithName:@"Human"] ]...

Cocoa-Bindings : Bind NSComboBox selection to a field in NSObjectController

Hello, in my application I have a NSObjectController bound to all controls on the user interface. This works fine so far. The only problem I have is binding the selection of an NSComboBox to the same ObjectController. As far as I found out today the value of a ComboBox is always a string so the field in the Class of the OBjectController...

Differences between NSTableView and NSCollectionView

I'm trying to decide which path to take for developing my Snow Leopard app. First, I should preface with the obvious differences: NSTableView can have multiple columns of data for representing different parts of the same "element" of data (a row) where NSCollectionView can display a grid of data as well, but every row+column combo is it...