Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WORKAROUND: Bound popup's current selection



FWIW, the solution was to programmatically add the binding after adding
the first item to the array.

Chuck Musser wrote:

I have a popup's selectedIndex bound to an NSArrayController's selectionIndex property. This allows the popup to display a text field of the currently selected array element, but it has an interesting (and undesirable) side effect. When the underlying array is empty, the popup displays a large integer value: 2147483647. Once I add an element, the integer disappears and the popup works nicely.

Is this binding the proper way to do this? It's the closest I can get to the desired popup behavior: show a blank when the list is empty and show a label from the selected object when it's not.

I've tried a few other things, like setting the No Selection and Null Placeholder to "0". These changes had no effect. I also tried a different binding altogether: binding the popup's selectedValue to the NSArrayController's selection.label property. That binding results in odd behavior. I can add one element, but subsequent new elements don't show up in the popup. Even still, that approach was somewhat encouraging--with the No Selection Placeholder set to a single space, my popup started out blank, like I wanted.

Is the proper technique to use my original binding, but delay it until after the first element is added?

Chuck
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Bound popup's current selection (From: Chuck Musser <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.