Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSTextTab

Inherits from
Implements
Package
com.apple.cocoa.application
Companion guide

Overview

An NSTextTab represents a tab in an NSParagraphStyle object, storing an alignment type and location. NSTextTabs are most frequently used with the Application Kit’s text system and with NSRulerView and NSRulerMarker objects. See the appropriate class specifications for more information on these uses.

The text system supports four alignment types: left, center, right, and decimal (based on the decimal separator character of the locale in effect). These alignment types are absolute, not based on the line sweep direction of text. For example, tabbed text is always positioned to the left of a right-aligned tab, whether the line sweep direction is left to right or right to left. A tab’s location, on the other hand, is relative to the back margin. A tab set at 1.5”, for example, is at 1.5” from the right in right to left text.

Tasks

Constructors

Getting Tab Stop Information

Getting Text Tab Information

Constructors

NSTextTab

Creates an empty NSTextTab.

public NSTextTab()

Creates an NSTextTab with an alignment of type at location on the paragraph.

public NSTextTab(int type, float location)

Discussion

The location is relative to the back margin, based on the line sweep direction of the paragraph. type can be any of the values described in “Constants.”

Creates an NSTextTab with the text alignment, location, and options.

public NSTextTab(int alignment, float loc, NSDictionary options)

Discussion

The text alignment is used to determine the position of text inside the tab column. See the “Constants” section for a mapping between alignments and tab stop types.

Availability

Instance Methods

alignment

public int alignment()

Discussion

Returns the text alignment of the tab, as defined by the “Constants” of NSText.

Availability

location

Returns the receiver’s ruler location relative to the back margin.

public float location()

options

Returns the dictionary of attributes associated with the tab.

public NSDictionary options()

Availability

tabStopType

Returns the receiver’s tab stop type.

public int tabStopType()

Discussion

The possible values are listed in “Constants.”

Constants

These constants describe the various type of tab stops:

Constant

Description

LeftTabStopType

A left-aligned tab stop.

RightTabStopType

A right-aligned tab stop.

CenterTabStopType

A center-aligned tab stop.

DecimalTabStopType

Aligns columns of numbers by the decimal point.

The following constant specifies the terminating character for a tab column:

Constant

Description

TabColumnTerminatorsAttributeName

The value is an NSCharacterSet. The character set is used to determine the terminating character for a tab column. The tab and newline characters are implied even if they don’t exist in the character set. This attribute is optional.

The following mappings define the conversions between text alignment in NSTextTab and tab stop types defined by NSTextTab:

To tab stop type:

Alignment

Tab Stop Type

LeftTextAlignment

LeftTabStopType

RightTextAlignment

RightTabStopType

CenterTextAlignment

CenterTabStopType

JustifiedTextAlignment

LeftTabStopType

NaturalTextAlignment

LeftTabStopType or RightTabStopType, depending on the user setting

RightTextAlignment with terminator

DecimalTabStopType

From tab stop type:

Tab Stop Type

Alignment

LeftTabStopType

LeftTextAlignment

RightTabStopType

RightTextAlignment

CenterTabStopType

CenterTextAlignment

DecimalTabStopType

RightTextAlignment with the decimal character for the user setting



Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.