NSPredicateEditor: Stop rows from drawing a background

155 views Asked by At

Here's an image of an NSPredicateEditor in one of my apps:

NSPredicateEditor

What I'd like to do is stop the class from drawing the grey background in each row and the "separator" lines between rows, leaving just the popup buttons, textfields and text in each row. After much googling and various attempts to hack the class, I haven't found a way to do this.

I AM aware of another, similar question about NSPredicateEditor on SO, but that person wanted to draw custom, alternating rows. I'm hoping someone might have a trick to simply stop the background drawing altogether.

Thanks!

2

There are 2 answers

4
Ely On BEST ANSWER

To prevent the drawing of separator lines in the NSPredicateEditor, just use this extremely simple sub class (Swift 4):

import Cocoa

class PredicateEditor: NSPredicateEditor {
    override func draw(_ dirtyRect: NSRect) {}
}
2
Dave DeLong On

Unfortunately, there's no way to do this. :(

I suggest that you file an enhancement request at https://bugreport.apple.com.