• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Binding Buttons and Popup Menus to NSDictionary made from a prefs plist?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding Buttons and Popup Menus to NSDictionary made from a prefs plist?


  • Subject: Binding Buttons and Popup Menus to NSDictionary made from a prefs plist?
  • From: Robert Monaghan <email@hidden>
  • Date: Mon, 26 Jan 2009 07:09:40 -0800

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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Binding Buttons and Popup Menus to NSDictionary made from a prefs plist?
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: release static pointers
  • Next by Date: Re: Accessing private members of another object of the same class
  • Previous by thread: Configuring a Port-based Input Source -- Part 2
  • Next by thread: Re: Binding Buttons and Popup Menus to NSDictionary made from a prefs plist?
  • Index(es):
    • Date
    • Thread