Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTextContainerMBS class.

NSTextContainerMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 19.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Initializes a text container with no bounds.

Returns the newly initialized text container.

See also:

NSTextContainerMBS.Constructor(size as NSSizeMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Initializes a text container with a specified bounding rectangle.

size: The size of the text container's bounding rectangle.

Returns the newly initialized text container.

The new text container must be added to an NSLayoutManager object before it can be used. The text container must also have an NSTextView object set for text to be displayed. This method is the designated initializer for the NSTextContainer class.

See also:

NSTextContainerMBS.containerSize as NSSizeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The size of the receiver's bounding rectangle.

size: The new size of the text container's bounding rectangle.
This method also sends textContainerChangedGeometry to the text container's layout manager.
(Read and Write computed property)

Some examples using this property:

NSTextContainerMBS.containsPoint(p as NSPointMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Overridden by subclasses to return whether a point lies within the receiver's region or on the region's edge—not simply within its bounding rectangle.

True if aPoint lies within the receiver's region or on the region's edge—not simply within its bounding rectangle - false otherwise.

For example, if the receiver defines a donut shape and aPoint lies in the hole, this method returns false. This method can be used for hit testing of mouse events.

The default NSTextContainer implementation merely checks that aPoint lies within its bounding rectangle.

NSTextContainerMBS.heightTracksTextView as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Controls whether the receiver adjusts the height of its bounding rectangle when its text view is resized.

value: True if the receiver should follow changes to the height of its text view, false otherwise.
(Read and Write computed property)

NSTextContainerMBS.isSimpleRectangularTextContainer as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Overridden by subclasses to return whether the receiver's region is a rectangle with no holes or gaps and whose edges are parallel to the text view's coordinate system axes.

True if the receiver's region is a rectangle with no holes or gaps and whose edges are parallel to the text view's coordinate system axes, false otherwise.

A text container whose shape changes can return true if its region is currently a simple rectangle, but when its shape does change it must send textContainerChangedGeometry to its layout manager so the layout can be recalculated.

The default NSTextContainer implementation of this method returns true.

NSTextContainerMBS.layoutManager as NSLayoutManagerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The layout manager.

This method is invoked automatically when you add a text container to a layout manager; you should never need to invoke it directly, but might want to override it. If you want to replace the layout manager for an established group of text system objects, use replaceLayoutManager.
(Read and Write computed property)

NSTextContainerMBS.lineFragmentPadding as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The amount by which text is inset within line fragment rectangles.

Value: The amount by which text is inset within line fragment rectangles, in points.

This method also sends textContainerChangedGeometry to the text container's layout manager.

Line fragment padding is not designed to express text margins. Instead, use the NSTextView method setTextContainerInset, paragraph margin attributes, or the position of the text view within a superview.
(Read and Write computed property)

NSTextContainerMBS.replaceLayoutManager(l as NSLayoutManagerMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Replaces the layout manager for the group of text system objects containing the receiver.

All text containers and text views sharing the original layout manager share the new layout manager. This method makes all the adjustments necessary to keep these relationships intact, unlike setLayoutManager.

Some examples using this method:

NSTextContainerMBS.textView as NSTextViewMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The text view.

This method sends setTextContainer to aTextView to complete the association of the text container and text view.

Because you usually specify a text container when you create a text view, you should rarely need to invoke this method. A text container doesn't need a text view to calculate line fragment rectangles, but must have one to display text.

You can use this method to disconnect a text view from a group of text system objects by sending this message to its text container and passing nil as aTextView.
(Read and Write computed property)

Some examples using this property:

NSTextContainerMBS.widthTracksTextView as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Controls whether the receiver adjusts the width of its bounding rectangle when its text view is resized.

Returns true if the receiver adjusts the width of its bounding rectangle when its text view is resized, false otherwise.

If the receiver does track the text view width, its width is adjusted to the width of the text view minus twice the inset width (as given by NSTextView's textContainerInset method).
(Read and Write computed property)

Some examples using this property:

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


The biggest plugin in space...