Interesting DesktopTextField with an image

I’ve just seen this interface in Apple’s Numbers application:

Interestingly that replace field is something I’ve always wanted, I just didn’t know what it would look like. I always thought my find / replace dialog was unbalanced, due to the spyglass in the search field and nothing in the replace:

Now I know what the solution looks like I’m left wondering how to get an image into the text field, without it being in the actual content. I pretty sure there isn’t an Image property on a text field, even the NSTextField that exists behind the scenes. Any thoughts?

Well, a NSTextField contains a NSTextFieldCell, which you could subclass in Objective-C.

Then you could change the rectangle it uses to draw text to provide some space on the left.
Actually, since you can specify a imageRect and titleRect, you may just use the image property to put in an image and have it draw on the left and the text on the right.

You may even be able to use CustomNSTextFieldCellMBS to do this.

Interesting thanks. I’ll take a look.

I made one using a containercontrol.
inside a bevelbutton for the magnifying glass icon, a canvas with the small cross to cancel the search, a roundrectangle for the background, and a textfield.