cocoa-bindings

NSArrayController binding : Suppress "No selection"

Hello, I have a texfield bound to an ArrayController. The controller key is "selection" because I select items from a NSTableView. But when there are no items in the table the textfield shows the gray text "no selection". How can I suppress this text and have just an empty textfield? Or how can I change the "No selection" text to somet...

Cocoa-Binding : Submit changes manually?

Hello in my application I have a NSTableView bound to an ArrayController (arrangedObjects). I also have a Details-View (just some textfields) bound to the same Controller (selection). Now every time I edit a textfield the changes are automatically send to the ArrayController and the Table changes as well. How can I avoid this? What I w...

How do I set the default selection for NSTreeController at startup?

The Background I've built a source list (similar to iTunes et al.) in my Cocoa app. I've got an NSOutlineView, with Value column bound to arrangedObjects.name key path of an NSTreeController. The NSTreeController accesses JGSourceListNode entities in a Core Data store. I have three subclasses of JGSourceListNode - JGProjectNode, JGGro...

Cocoa @sum array operator too slow - alternatives?

I've got a text field value bound to a key path that uses @sum. When the array controller is filtered, the text field updates properly, but extremely slowly, lagging the UI or outright beachballing after every key press (less so as the number of items in arrangedObjects decreases). There is no lag if I don't use @sum; I've narrowed it do...

Assign TableView column binding to a specific core-data object in to-many related entity based on separate attribute

How would I assign a column of a TableView to be a specific entry in a Core Data entity that is linked to the NSArrayController via a to-many relationship? For example Entity: MovieEntity Attributes: title(NSString), releaseDate(NSDate) Relationship: posters<-->> PosterEntity Entity:PosterEntity Attributes: imageLocation(NSURL), defau...

NSTableView binding problem

I have only just started with XCode (v3.2.2) and Interface Builder and have run into a problem. Here is what I have done: I have made a class to be the datasource of a NSTableView: @interface TimeObjectsDS : NSControl { IBOutlet NSTableView * idTableView; NSMutableArray * timeObjects; } @property (assign) NSMutableArray * timeObje...

Clean bindings with structs

I have a model class for which it makes quite a lot of sense to have NSSize and NSPoint instance variables. This is lovely. I'm trying to create an editing interface for this object. I'd like to bind to size.width and whatnot. This, of course, doesn't work. What's the cleanest, most Cocoa-y solution to this problem? Of course I could w...

[Cocoa] CoreData bindings for NSPopupButton

I'm looking to use a dropdown menu (possibly an NSPopupButton object) to represent the hierarchical results of two Core Data entities (Genre and Movie) and their relationships. In my current data model, my Genre entity has a one-to-many relationship with my Movie entity. What I'm now looking to do is generate the contents of an NSPopupB...

Observing model changes with Cocoa Bindings and NSArrayController

I've got an NSArrayController bound to a mutable array in my controller, which manages an array of my model objects. The array controller is bound to my UI. It works well. Now I'm trying to manually observe when a value changes in my model in my controller class (basically I'm marking the changed model as "needsToSave" for later on, but...

How can I bind NSButtonCells title to a controllers arrangedObject?

Hello, I have an OutlineView with one column of NSButtonCell checkboxes. The content binding of the outline view is to a TreeController. Currently, I can bind the checkbox status to the content of the TreeController by binding the value of the Table Column to TreeController.arrangedObjects.shouldBeCopied. However, I can only seem to bin...

NSOutlineView not redrawing

Hello, I have an NSOutlineView with checkboxes. I have the checkbox state bound to a node item with the key shouldBeCopied. In the node item I have the getters and setters like so: -(BOOL)shouldBeCopied { if([[self parent] shouldBeCopied]) return YES; return shouldBeCopied; } -(void)setShouldBeCopied:(BOOL)value { ...

Cocoa Bindings and Application Preferences - Crash

Using the document provided by Apple to create an application preferences window that doesn't require any extra code, I seem to have triggered a crash that cannot be traced by me. While the stuff from Apple is older, I believe I have the settings pretty much the same as shown here: When I run my application (Hcode) and go to the pref...

Binding a text field to Shared User defaults controller doesn't use null value

I set the text field to bind with a values controller key, a keypath of spacesPerTab, and setting 4 as the placeholder values. But when executing it, the text field displays nothing. This works for checkboxes. ...

Add objects to NSDictionaryController

I have an NSTableView which is bound to an NSDictionaryController. I have set this and the content dictionary through the interface builder. The question I have is, how do I add objects to the dictionary in a manner that the controller will see it automatically and display it in the table. I've seen in examples about NSArrayController...

How do I share an NSArrayController between two nib files?

I have an array of images, and two nib files. One nib file has a window that displays the images in an NSTableView. The other nib has a window that draws the array of images into an NSView, and also draws a highlight over the images that are selected. The array of images is controlled by an NSArrayController. I'm having trouble getting ...

Core Data, Bindings, value transformers : crash when saving

Hi, I am trying to store a PNG image in a core data store backed by an sqlite database. Since I intend to use this database on an iPhone I can't store NSImage objects directly. I wanted to use bindings and an NSValueTransformer subclass to handle the transcoding from the NSImage (obtained by an Image well on my GUI) to an NSData contain...

How to bind a control to a singleton in Cocoa?

I have a singleton in my FTP app designed to store all of the types of servers that the app can handle, such as FTP or Amazon S3. These types are plugins which are located in the app bundle. Their path is located by applicationWillFinishLoading: and sent to the addServerType: method inside the singleton to be loaded and stored in an NSMu...

Cocoa Core data: cannot save Created Items in NSTableview

Hello, I'm am a beginner in mac os x development and am trying to get started with all this. Here is my problem : I've create a non-document based cocoa app using core data as storage. I've added an entity and attributes to the xdatamodel. In IB i've created an NSArrayController and linked it properly. I've created an nstableview binde...

NotApplicable marker with display pattern

Ok, so I'm pretty new to Cocoa, especially Bindings, but here's what I'm trying to do. I've got a Core Data model consisting of two entities: Category and Item. Category has a to-many relationship to Item called children, and Item has a relationship to Category called parent. Item has two attributes that Category does not have: quantity...

Simple NSTableView bindings example

I am trying to populate a 2-column NSVTableView via bindings, but the data is not showing up in the table. In XCode: I have a NSMutableArray in my AppDelegate that will hold the data, as well as the corresponding @property and @synthesize. On an event, I call [removeAllObjects] on the NSMutableArray and repopulate it with some NSDicti...