Platforms to show: All Mac Windows Linux Cross-Platform

NSTextTabMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
An NSTextTab object represents a tab in an NSParagraphStyle object, storing an alignment type and location.
Example
// This example needs a window with TextArea1.
// show a price list with a right aligned and a decimal tab stop
Var style As New NSMutableParagraphStyleMBS
Var tabs() As NSTextTabMBS
tabs.Add New NSTextTabMBS(NSTextTabMBS.NSRightTabStopType, 200) // quantity
tabs.Add New NSTextTabMBS(NSTextTabMBS.NSDecimalTabStopType, 300) // price
style.setTabStops tabs

Var text As New NSMutableAttributedStringMBS
text.appendString "Apples" + Chr(9) + "12" + Chr(9) + "3.50" + EndOfLine
text.appendString "Bananas" + Chr(9) + "6" + Chr(9) + "12.95" + EndOfLine
text.appendString "Cherries" + Chr(9) + "200" + Chr(9) + "0.99" + EndOfLine
text.addAttribute(NSAttributedStringMBS.NSParagraphStyleAttributeName, style, New NSRangeMBS(0, text.length))

TextArea1.NSTextViewMBS.textStorage.appendAttributedString text

NSTextTab objects 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.

Tab Stop Types

Constant Value Description
NSCenterTabStopType 2 A center-aligned tab stop.
NSDecimalTabStopType 3 Aligns columns of numbers by the decimal point.
NSLeftTabStopType 0 A left-aligned tab stop.
NSRightTabStopType 1 A right-aligned tab stop.

This class has no subclasses.

Blog Entries

Some methods using this class:

Some properties using this class:

Some examples using this class:

Some related classes:


The items on this page are in the following plugins: MBS MacCocoa Plugin.


NSTextTableMBS   -   NSTextViewMBS


The biggest plugin in space...