Mac Developer Library

Developer

AppKit Framework Reference NSTextFieldCell Class Reference

Options
Deployment Target:

On This Page
Language:

NSTextFieldCell

The NSTextFieldCell class adds to the text display capabilities of the NSCell class by allowing you to set the color of both the text and its background. You can also specify whether the cell draws its background at all. More...

Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.0 and later.
  • Sets the color of the background that the receiver draws behind the text.

    Declaration

    Swift

    @NSCopying var backgroundColor: NSColor?

    Objective-C

    @property(copy) NSColor *backgroundColor

    Parameters

    aColor

    The background color of the text field cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the color of the background the receiver draws behind the text.

    Declaration

    Swift

    @NSCopying var backgroundColor: NSColor?

    Objective-C

    @property(copy) NSColor *backgroundColor

    Return Value

    The background color of the text field cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Controls whether the receiver draws its background color behind its text.

    Declaration

    Swift

    var drawsBackground: Bool

    Objective-C

    @property BOOL drawsBackground

    Parameters

    flag

    If YEStrue, the receiver draws its background; if NOfalse it draws nothing behind its text.

    Discussion

    In order to prevent inconsistent rendering, background color rendering is disabled for rounded-bezel text fields.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the receiver draws its background color.

    Declaration

    Swift

    var drawsBackground: Bool

    Objective-C

    @property BOOL drawsBackground

    Return Value

    YEStrue if the receiver draws its background color behind its text, NOfalse if it draws no background.

    Discussion

    In order to prevent inconsistent rendering, background color rendering is disabled for rounded-bezel text fields.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets up the field editor. You never invoke this method directly; by overriding it, however, you can customize the field editor.

    Declaration

    Swift

    func setUpFieldEditorAttributes(_ textObj: NSText) -> NSText

    Objective-C

    - (NSText *)setUpFieldEditorAttributes:(NSText *)textObj

    Discussion

    When you override this method, you should generally invoke the implementation of super and return the textObj argument. For information on field editors, see Using the Window’s Field Editor in Window Programming Guide.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Directs the cell’s associated field editor to post text change notifications.

    Declaration

    Swift

    func setWantsNotificationForMarkedText(_ flag: Bool)

    Objective-C

    - (void)setWantsNotificationForMarkedText:(BOOL)flag

    Parameters

    flag

    If YEStrue, the field editor posts text change notifications (NSTextDidChangeNotification) while editing marked text; if NOfalse, notifications are delayed until the marked text confirmation.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns an array of locale identifiers representing input sources that are allowed to be enabled when the receiver has the keyboard focus.

    Declaration

    Swift

    var allowedInputSourceLocales: [AnyObject]?

    Objective-C

    @property(copy) NSArray *allowedInputSourceLocales

    Return Value

    The locale identifiers of allowed input sources.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Sets an array of locale identifiers representing input sources that are allowed to be enabled when the receiver has the keyboard focus.

    Declaration

    Swift

    var allowedInputSourceLocales: [AnyObject]?

    Objective-C

    @property(copy) NSArray *allowedInputSourceLocales

    Parameters

    localeIdentifiers

    The new locale identifiers of allowed input sources.

    Discussion

    You can use the meta-locale identifier, NSAllRomanInputSourcesLocaleIdentifier, to specify input sources that are limited for Roman script editing.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Specify the bezel style of the text field cell.

    Declaration

    Swift

    enum NSTextFieldBezelStyle : UInt { case SquareBezel case RoundedBezel }

    Objective-C

    enum { NSTextFieldSquareBezel = 0, NSTextFieldRoundedBezel = 1 }; typedef NSUInteger NSTextFieldBezelStyle;

    Constants

    • SquareBezel

      NSTextFieldSquareBezel

      Corners are square.

      Available in OS X v10.2 and later.

    • RoundedBezel

      NSTextFieldRoundedBezel

      Corners are rounded.

      Available in OS X v10.2 and later.

    Discussion

    The bezel style of a text field is set using the bezelStyle and setBezelStyle: methods.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.2 and later.