I am wondering how to use NSPredicateEditor to define subpredicates from out the user's perspective - and how to implement it.
Suppose we have a simple NSPredicateEditor created in IB as shown below.
It has 2 items to choose from:
So we can create a predicate like
lastname ==[c] "Smith" OR lastname ==[c] "Miller" OR address.street ==[c] "3rd Avenue"
Now, if I want to have only Millers selected, living in the 3rd Avenue, what can I do ? I would prefer to have a button like "s" to create a subpredicate just below the selected line (Miller) to get this result:
lastname ==[c] "Smith" OR (lastname ==[c] "Miller" AND address.street ==[c] "3rd Avenue")
Unfortunately, there is no other button than + or - for each item (row). Is there any other way ? Can it be done with low programmatically effort ?
Set "Nesting" of the predicate editor to "Compound". At runtime: Press the Option Key and the + button will change to … for adding a compound row.