cocoa-bindings

Binding value for NSTableView, but tooltip gets set as well

I've set up an NSTableView in Interface Builder to be populated from an NSArray. Each value of the array represents one row in the table. The value is bound correctly, but as a side effect, the table cell's tooltip is set to the string representation of the bound object. In my case, the NSArray contains NSDictiorany objects and the tool...

How can I write cocoa bindings as code instead of in the Interface Builder?

In my modell got an NSMutableArray that keeps track of a changing number of elements. In my view I got a NSTextField that shows the number of elements. The view gots unarchived from the nib file and alloc/inits the modell. Therefore it knowns about the modell and the contained array. I established the connection as follows. In the Inter...

Setting a default selection for an NSPopupButton?

Is it possible to set a default selection on an NSPopupButton? I have one that allows the user to select the type of server they want to set up, but since an NSPopupButton always shows the first item, they may ignore it if that's the type they want. However, even though that item is being displayed, calling -selectedItem returns (null). ...

displaying web pages over web views in collection view using cocoa bindings

Hi all, I tried sample example given at this link - Collection View Programming Guide It is simple and it worked. Considering it as a reference I tried a simple application which will show a collection view of web views with some web page displayed over each web view. The model class has two properties: NSString *pageName, and NSURL *...

What are the correct bindings for an NSComboBox for use with Core Data

Imagine if you will a Core Data app with two entities (Employee, and Department). Employees have a to-one relationship with department (department) and the inverse is a to-many relationship (employees). In the UI you can select individual Employee entities and edit the details in a detail area (there are of course other attributes and th...

Binding to a relations property in Core Data

I'm new in Core Data, and i got a problem i can't get my head around how to do "the right way" I'll try and examplify my problem. I got a entity Car. And a list of all the cars in my program. The cars have some attributes, but they are not predefined. So for each car i want to be able to define some properties. Therefore i have define...

Difference between mutableArrayValueForKey and calling insertObject:inEmployeesAtIndex: directly

I have a question regarding using KVO-compliant methods to insert/remove objects from an array. I'm working through Aaron Hillegass' Cocoa Programming for Mac OS X and I saw the following line of code (in the insertObject:inEmployeesAtIndex: method: [[undoManager prepareWithInvocationTarget:self] removeObjectFromEmployeesAtIndex:index];...

how to show avg of employees salary in a NSTextField using NSArrayController and cocoa bindings

Hi all, I am new to cocoa bindings so I tried to make a simple application which will simply calculate avg of employees salary and display it in a text field, using cocoa bindings. I followed these steps: Made the model class : Person with one property for now - @property (readwrite, assign) int salary; In the application delegate cl...

Sorting of table column by string length not working as intended when done in IB via cocoa - bindings

Hi all, I made a sample application displaying list of employees with their salaries over NSTableView using NSArrayController. Basic functionality is working as intended. Also sorting is working fine when Selector - compare or caseInsensitiveCompare is assigned in attribute pane for table column- employeeName. Problem occurs when I tr...

Dashcode mysql datasource binding

Hi I've got a tricky question (aren't they all tricky?) I'm converting a database driven site that uses php, to a site being built with Dashcode. The current site selects data held in a mySQL database and dynamically creates the page content. Originally this was done to reduce site maintenance because all the current content could be ...

Cocoa Bindings in the face of a million of items in an NSArray

I'm writing a GUI for MongoDB using Cocoa. It's going well, but I don't know how to make KVO properties that would be lazily loaded. How does one handle that? For instance, viewing the documents in a Mongo collection. The collection might have a million items in it. I suspect I shouldn't be downloading the full 2-5 GiB of data to my Coc...

NSOutlineView, NSTreeController and a heterogeneus hierarchy

Hello all, In page 40 of Marcus Zarra's Core Data book, he suggests that, since NSTreeController requires the same key for accessing all the objects in the hierarchy (for example, children) and that could imply less meaningful relationship names, you can write additional accessors for the desired relationships. I think that this is a gr...

For reopening the autosaved documents the method - (id)initForURL: withContentsOfURL: ofType: error:, gets not call for me

Hi, I have saved my document using autosave functionality at default path (~/Library/Autosave Information/). but while launching the application the autosaved documents are not opening. Even the control does not go this method: - (id)initForURL:(NSURL *)absoluteDocumentURL withContentsOfURL:(NSURL *)absoluteDocumentContentsURL ofType:(...

Why is NSArrayController not calling accessor methods via bindings?

I am trying to intercept an NSArrayController (thingsController) addObject method with the following accessor method. - (void)insertObject:(Thing *)thing inThingsAtIndex:(NSUInteger)index; I have two classes: Thing and MyDocument. Thing has one property: name. MyDocument has an NSMutableArray called things and an NSArrayController ...

Cocoa bindings between NSTableView and NSMutableArray refuse to update

Ok, I'm very new to Obj-C and Cocoa, but I'm sure my bindings here are correct. I've been googling, searching stack overflow and have checked my values again and again. So, here are my bindings: They connect to this class: @interface TMMaddMangaWindowDelegate : NSWindowController { ... } ... @property (copy) NSMutableArray* mangaLi...

How do I ensure proper KVO behaviour for my NSSlider-like custom control?

Hi, Let's say you have a custom control similar to NSSlider but with support for choosing a range of values, instead of a single value. The obvious choice of properties is minValue, maxValue, leftValue, rightValue, or however you wanna name them. You'd probably also want to make sure that leftValue and rightValue always lay in between m...

how to get count of records and aggregate of values via NSArrayController and cocoa bindings

Hi all, I am trying a simple application using NSArrayController and cocoa bindings. The application contains - a table with only one column, two buttons "+, -" to add and delete records, two text fields to show count of records entered and sum of these records. To allow user to enter numbers only, I have assigned NSNumberFormatter to ...

Bind Top 5 Values of a To-Many Core Data Relationship to Text Fields

Hi, I am making an application that represents a cell phone bill using Core Data. I have three entities: Bill, Line, and Calls. Bills can have many lines, and lines can have many calls. All of this is set up with relationships. Right now, I have a table view that displays all of the bills. When you double click on a bill, a sheet comes ...

CoreData and DataBindings with cocoa

Hi all, I'm developping a little DB book management Mac OSX app with CoreData and DataBindings. I have a TableView with all the book authors. I would another TableView that rapresent all books written by the author selected in the previous table... The both tables are managed with two ArrayController in IB. My problem is that I don't kn...

Starting Mac Application development

Hi all, I am newbie to Mac Application Development.I am planning for an application having the features like de-fragmenting the mac ,parental controls, data backup etc... I do have some exposure to Objective C (Developed a small application for iphone) So please anyone could advice me regarding where to start,where to find best re...