> On Jun 16, 2016, at 10:14 , Keary Suska <[email protected]> wrote:
> 
> 
>> On Jun 15, 2016, at 10:15 PM, Rick Mann <[email protected]> wrote:
>> 
>> I have a popup menu that's bound to an NSArrayController of AVCaptureDevice 
>> objects. These objects have a "localizedName" property that I use for the 
>> content values, and the content and content objects point to the 
>> NSArrayController.
>> 
>> I also have a property on my view controller used for the selected object.
>> 
>> The problem comes when I re-build the array of objects that backs the 
>> NSArrayController (in the case where the selected device disappears): I 
>> assign a new array to the property, and the selected item in the popup menu 
>> changes to be the object description for the AVCaptureDevice object still in 
>> the selected property.
>> 
>> IB doesn't let me bind to selected value when I'm binding to selected 
>> object. Is there anything I can do here?
> 
> IIRC, this is what happens when the selected object doesn’t exist in the 
> content array (or for whatever reason cannot be found by the API). Are you 
> simply modifying the content array (adding/removing), or re-creating objects?
> 
> In any case, you might have better results using KVC-compliat mutator methods 
> on the content array rather than replacing it entirely.

Unfortunately, I get a new array from macOS. It's substantially more work to 
try to manage the changes myself.

> On Jun 16, 2016, at 11:16 , Ken Thomases <[email protected]> wrote:
> 
> Why not clear the property for the selected object?  Or assign it to one of 
> the (new?) objects in the array?

Well, I can, but I wonder why I should have to. I think it's nice for the UI to 
keep the one that was selected, and let the user change to another one when 
ready.

The objects and values can be specified separately for the menu items, they 
should be specifiable for the selected item, as well (since it clearly supports 
having a selected item that's not a member of the array).

-- 
Rick Mann
[email protected]



_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to