Re: Please help. At wit's end binding NSPopupButtonCell selection
Re: Please help. At wit's end binding NSPopupButtonCell selection
- Subject: Re: Please help. At wit's end binding NSPopupButtonCell selection
- From: Chris Hanson <email@hidden>
- Date: Tue, 04 Nov 2008 09:00:38 -0800
To summarize what you've done:
1. You set up a Pages NSArrayController.
2. You set up a Masters NSArrayController.
3. You bind the pop-up's Content Values to the Masters controller's
"arrangedObjects.name".
4. You bind the pop-up's Selected Value to the Pages controller's
"selection.master" property.
I think the issue is that Step #4 is incorrect, and you're missing
Step #5. There's also one other caveat.
Step 4 should be:
4. You bind the pop-up's Selected Object to the Pages controller's
"selection.master" property.
The Selected Value binding is for the title of the selected item; the
Selected Object binding is used to actually choose the selected item.
The missing Step 5 is:
5. Bind the pop-up's Content to the Masters controller's
"arrangedObjects".
This will ensure that each item in the pop-up represents an item
available via the Masters controller. Think of it this way: "Content
Values" and "Selected Value" are about what the pop-up shows to the
user, while "Content" and "Selected Object" are about the underlying
objects the pop-up represents.
One other thing to ensure is that you're *only* using the specific
Masters controller you set up in Step #2 for populating this pop-up.
One common issue is to try to "consolidate" controllers; since
bindings are generally two-way, this can cause unexpected behavior.
Use separate controllers for separate situations, even if they're
bound to the same thing.
-- Chris
_______________________________________________
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