Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zeppenwolf

macrumors regular
Original poster
Nov 17, 2009
129
3
My app implements the NSWindowRestoration paradigm.

One window displays an NSCollectionView and a corresponding NSSearchField, where the NSSF works as one might expect: any string typed into the field causes the CV to display an item in the source array if an only if the itemName contains the string in the field.

So it works, and that part's fine.

When I encode the window, I've found that it's up to me to encode and restore the string in the NSSF. Ok, no biggie.

But when the time comes to restore the string which was in the NSSF upon quitting, I find that setting the actual text value works fine, but it doesn't have any effect on the CV; the CV is not filtered the way it was and should be.

For the moment, I've worked around this by restoring the NSSF text, then telling the NSSF to be 1st responder, and then posting a KeyDown <CR> event... That makes the CV respond, but this really doesn't seem like the way things are supposed to be.

ESPECIALLY considering that when live, a <CR> key is not even needed for the CV to respond to the NSSF-- just typing or deleting chars one at a time makes the CV respond immediately...

There isn't any actual code, only the binding in IB,

Search//Predicate// [file's owner].viewController.arrayController.filterPredicate

I have confirmed that at the time I set the NSSF text to be what it was, the array which feeds the CV exists, IOW it's not a question of the NSSF being awoken from NIB before the array exists.

Q: How can I cause the NSSF to affect the CV without a KeyDown hack? Thx.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.