Hi Everyone,

I am trying to wrap my head around using a plist.
Everything that I have seen on the mailing list so far, involves using an NSTableView to work with NSDictionaries. Here is what I have set up. I have several NSButtons and pre-populated NSPopup Buttons, where the index values or states are stored as NSNumbers inside a plist file. Fairly easy to figure out. You just specify a key, and you get an NSNumber Object.

I am now trying use several of these plists. I have a list of projects in an NSTextColum, each with its own plist. I want to select one of the projects in the tableview, and have the controls changed to reflect the states from the appropriate plist. Again, in theory, plists should work well, here.

So far, I have an NSArrayController working well, with a list of projects/plists. However, I can't seem to get the bindings to work for the various controls. I am attempting to bind the buttons and popup menus to *something" that that can drive them. I not only want the controls to be updated with each project that is selected, but have the NSDictionary that is holding the plist, to be updated when the user changes the controls.

You would think that this is straight forward.

Here is what I have tried:
NSDictionaryController.
I have an observeValueForKeyPath set up, to watch my NSArrayController, with a list of projects. Once I have a project selected, it then binds an NSMutableDictionary to the NSDictionaryController Something like this: [seqPrefsCtlr bind:NSContentDictionaryBinding toObject:self withKeyPath:@"prefsDict" options:nil];

No problem there.. But then I can't seem to figure out what to bind the assorted NSButtons and NSPopup menus to.

My other idea was to subclass NSArrayController, and override selectedObjects. With this, I wanted to bind each control to the NSMutableDictionary in File's owner (somehow), and have each control observe a key in the dictionary. This seems to be a one way street, however. I can get the keys in the dictionary to initially set the buttons/popups, but nothing else.

Is there any sort of example that shows how an NSDictionary can drive a pile of controls with bindings? Or should I just brute-force this, and write other code?

bob.



Robert Monaghan
Glue Tools LLC
629 State St. Suite 220
Santa Barbara, CA, 93101
United States

tel: +1 805 456 7997
fax: +1 805 456 7998

www.gluetools.com

_______________________________________________

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