Q: show/hide in NSTableView--use NSFilter?
Q: show/hide in NSTableView--use NSFilter?
- Subject: Q: show/hide in NSTableView--use NSFilter?
- From: Leonard Budney <email@hidden>
- Date: Sun, 22 May 2005 13:32:51 -0400
Hello,
I'm implementing an NSTableView with a column of checkboxes, and a
preference to show/hide checked items.
I've already done that using two mutable arrays: one bound to the
table view, and one to hold "hidden" items. When the KVO sees this
preference change, items are moved from the main array to the hidden
array and vice versa. This seems consistent with postings I've seen
on this list.
My question is, shouldn't I be using NSPredicate and asking the array
controller to filter the entries? The documentation hints that
NSPredicate is for use in implementing search, which I plan to do
soon. In addition, I plan to add other show/hide options, for example
hiding items whose "value" attribute is below a certain threshold.
The logic to show and hide items could become fairly complex as
options are added...
I'm thinking that perhaps I want to create an NSCompoundPredicate
that performs an AND on the various conditions: "display" column
checked; "value" above threshold; meets search criteria; etc.
Does that seem like the right thing to be doing? I would have to save
the predicate with the file, since some of the predicates are driven
by preferences.
Thanks!
Len.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden