views:

153

answers:

1

I've seen some apps are using alternating rows background in their predicate editors, but I can't figure out how they do it.

+2  A: 

Most of them pre-date NSPredicateEditor, and some (such as the one in iTunes) aren't even Cocoa. Some may be NSTableViews or NSOutlineViews with very complicated custom cells; others may be fully custom, descending directly from NSView.

Without being able to tell NSPredicateEditor to do it or reliably subclass NSPredicateEditor to do it (even if it has private methods you can override to customize its drawing, you can't rely on those existing), those are the only ways.

I don't think it's worth it. NSPredicateEditor and NSRuleEditor give you a lot of functionality for free or nearly so, and their default appearance is probably how Apple wants those views to look in all apps in the future. In this case, I say it's best to go with the flow.

Peter Hosey
Sad news. Thanks for the answer. But looking at those apps, for example The Hit List, their editor is much nicer than the default "gray" one. And I was almost sure they somehow customized NSPredicate/NSRuleEditor, since the app is relatively new and 10.5+ only.
Indoor
It looks and seems to work like NSPredicateEditor, but looking at the nib (in a text editor, since it's compiled) reveals that it's a “TRRuleEditor”, which the output from class-dump reveals is a direct subclass of NSView—so, it's a well-done clone. The credits for the app say that it's by Reinvented Software, but Google had no matches for “TRRuleEditor”.
Peter Hosey
Peter, thanks a lot! I did a class-dump, but I was not so smart to open nib with a text editor.
Indoor