Re: If Array Controller is empty, how to populate pop-up list?
Re: If Array Controller is empty, how to populate pop-up list?
- Subject: Re: If Array Controller is empty, how to populate pop-up list?
- From: Jenny M <email@hidden>
- Date: Sun, 17 Jan 2010 14:36:29 -0800
Hi Ken,
Thanks for your tips. We're closer I think. I took off the Selected Index
binding and instead bound the Selected Value to
ArrayController-selection-name. I'm probably binding it wrong though,
because I haven't quite gotten it to work yet.
I think what you say makes sense, about the selection objects and enabled
properties. I have a string in all three bindings' "No Selection
Placeholder" for the popup bindings (Content, Content Values, and Selected
Value), but instead, when the array controller is empty, the popupbutton is
both disabled and empty. "Conditionally Sets Enabled" is checked AND "Avoid
Empty Selection" is checked, but, no dice... You said this is what worked
for you? :/
Jenny
> With some experimentation, I discovered the following:
>
> I bound the pop-up's content to the array controller's arrangedObjects. I
> bound its Selected Value or Selected Object (but not Selected Index) to the
> array controller's selection with an appropriate model key path. For the
> content binding, I set a No Selection Placeholder string. Then, whenever
> the array controller had no selection, the pop-up showed the placeholder
> string.
>
> If the Selected Value binding's Conditionally Sets Enabled option is on
> (the default), then the pop-up is disabled when there's no selection in the
> array controller. This is sort of bad if the controlled array is not empty
> but the array controller has no selection. In that case, the pop-up shows
> the placeholder but is disabled, so the user can't access the other items in
> the pop-up. However, the array controller won't have no selection if its
> Avoid Empty Selection property is enabled (again, the default). With that
> property enabled, the pop-up shows the placeholder and is disabled only if
> there's nothing in the controlled array. If there are objects in the array,
> then the array controller has a selection and the pop-up shows it and is
> enabled.
>
> So, Conditionally Sets Enabled on the pop-up's Selected Value or Object
> binding, plus Avoids Empty Selection on the array controller works well.
> Turning both of those off makes for a functional but possibly strange
> interface; when the array is non-empty but the array controller has no
> selection, the pop-up shows the placeholder but is enabled and also contains
> the normal items.
>
> I hope that helps.
>
> Cheers,
> Ken
>
>
_______________________________________________
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