The NSPredicateEditor
's superclass NSRuleEditor
exposes a selectedRowIndexes: IndexSet
property (and corresponding selectRowIndexes(IndexSet, byExtendingSelection: Bool)
setter). Adding an observer on this property shows that it is indeed changed whenever a row in the predicate editor is clicked on. However, there is no visual indication that the row is selected or deselected.
I would like to visually highlight the selected rows in my predicate editor, but there are almost no view drawing methods to subclass or delegate methods to implement to customize the appearance of the editor. Can anyone suggest some way to convey to the use that rows of the rule editor have been selected?
In the NSPredicateEditorRowTemplate class you will find a property named
templateViews
As mentioned in the documentation from Apple you can override this to return additional views. Return an additional view and use it as an indicator for the selection.I customised NSPredicateEditorRowTemplate years ago to implement a Star rating control but would have to look for the code and how it was exactly done.
Hope this helps.