Using the Window’s Field Editor

Each window has a text object that is shared for light editing tasks. This object, the window’s field editor, is inserted in the view hierarchy when an object needs to edit some text and removed when the object is finished. The field editor is used by NSTextField objects and other controls, for example, to edit the text that they display. The fieldEditor:forObject: method returns a window’s field editor, after asking the delegate for a substitute using windowWillReturnFieldEditor:toObject:. You can override the fieldEditor:forObject: method of NSWindow in subclasses or provide a delegate to substitute a class of text object different from the NSTextView default, thereby customizing text editing in your application.