Popuplating an NSPopupButton with the contents of two NSArrayControllers

Posted by ndg on Stack Overflow See other posts from Stack Overflow or by ndg
Published on 2010-05-09T21:30:43Z Indexed on 2010/05/09 23:48 UTC
Read the original article Hit count: 262

Filed under:
|
|

I'm looking to populate an NSPopupButton with the contents of two NSArrayControllers. The NSArrayControllers are both bound to my Core Data Managed Object Context and represent separate entities (in this example: Person and Department).

Within my NSPopupButton, I would like a list of departments, and the people that work under them. Like so:

Department 1
  Person 1
  Person 2
Department 2
  Person 3
  Person 4

All departments would need to be disabled by default, meaning that users should only be able to select people listed within the dropdown.

I'm lost as to how I would go about doing something like this. The concept of manually populating an NSPopupButton seems fairly trivial, but I'm a bit shaky as to best to populate the element with Core Data objects.

Essentially, I'm just looking for someone to point me in the right direction. I imagine there's a right way to do this, and a number of very wrong ways.

© Stack Overflow or respective owner

Related posts about core

Related posts about data