On Oct 12, 2009, at 11:52 AM, Gustavo Pizano wrote:

Ok this is what I have:

1. InvoiceGenViewController.m -> Controller for the InvoiceGenView.xib
2. UserListViewController.m -> Controller for the UserListView.xib
3. InvoiceEditionViewController.m -> Controller for the InvoiceEditionView.xib

InvoiceGenView.xib, has a slipt view and InvoiceGenViewController has 2 IBOutlets NSView one for the each view of the split view and also has an instance of UserListViewController and InvoiceEditionViewController, so when loading the nib, I create those controllers with their respective nib files. So far so good.

The UserListView has an IBOutlet NSArrayController with a connection in IB to a NSArrayController instance called "Users Array". In IB for the UserListView.xib, I bind the NSManagedObjectContext to the Files's Owners managedObjectContext, which Im getting form the ApplicationDelegate. And I placed a NSTableView with the column binding to "Users Array" ; controller key :: arrangedObject ; Model Key Path: completeName. So when the whole window with all this views loads I can see in the ;left side a list of Users, displaying the concatenated name.

Anyway, its working till this point. The problem is that when I select an item form the NSTableView(which is in the UserListView), I want to display its details in the other view which is controlled by InvoiceEditionViewController and it's in another .xib. NO SUCCESS! :(

I have tried passing the instance of the NSArrayController from UserListViewController to InvoiceEditionViewController (IBOutlet also) and connecting it to an Instance of NSArrayController in the InvoiceEditionViewController.xib (called "Ref Users List"). Then setting the fields bindings to:
Bind : "Ref Users List"
Controller key : selection
Model Key Path:  firstName .... etc for the rest of fields.

This doesn't appear sensible, and you may have a number of problems. First, make sure that InvoiceEditionViewController is being instantiated properly. Second, simply have a reference to UserListViewController in InvoiceEditionViewController, which can be an outlet if InvoiceEditionViewController can be sensibly instantiated via xib, or set by other means. I recommend then to have an NSObjectController in InvoiceEditionViewController.xib whose content is bound to UserListViewController.NSArrayController.selection (using correct ivar/property names, of course).

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to