Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights Reserved.


Inherits From: NSControl : NSView : NSResponder : NSObject

Conforms To: NSCoding (NSResponder) NSObject (NSObject)

Declared In: AppKit/NSTextField.h

Class Description

An NSTextField is an NSControl object that can display a piece of text that a user can select or edit, and which sends an action message to its target if the user hits the Return key while editing. An NSTextField can also be linked to other NSTextFields, so that when the user presses Tab or Shift-Tab, the object assigned as the next or previous field gets a message to select its text.

An NSTextField is a good alternative to an NSText object for small regions of editable text, since the display of the NSTextField is achieved by using a global NSText object shared by objects all over your application, which saves on memory usage. Each NSWindow also has an NSText object used for editing of NSTextFields (and NSTextFieldCells in NSMatrices). An NSWindow's global NSText object is called a field editor, since it's attached as needed to an NSTextField to perform its editing. NSTextField allows you to specify an object to act as an indirect delegate to the field editor; the NSTextField itself acts as the NSText delegate if it needs to, then passes the delegate method on to its own NSText delegate.

Setting User Access to Text

Editing Text

Setting Tab Key Behavior

Assigning a Delegate

Modifying Graphic Attributes

Target and Action

Handling Events