Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTextAttachmentMBS class.

NSTextAttachmentMBS.Constructor(fileWrapper as NSFileWrapperMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes a newly allocated NSTextAttachment object to contain the given file wrapper.
Example
dim content as MemoryBlock = "Hello World"
dim f as NSFileWrapperMBS = NSFileWrapperMBS.initRegularFileWithContents(content)
f.filename = "HelloWorld.txt"

dim a as new NSTextAttachmentMBS(f)

Break // inspect in debugger

If fileWrapper contains an image file that the receiver can interpret as an NSImage object, sets the attachment cell’s image to the NSImage rather than to the icon of fileWrapper.

See also:

NSTextAttachmentMBS.Constructor(image as NSImageMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacBase Plugin 15.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes a newly allocated NSTextAttachment object with a cell and given image.
Example

Dim pic As Picture = LogoMBS(500)
Dim image As New NSImageMBS(pic)

// build attachment
Dim imageAttachment As New NSTextAttachmentMBS(image)
Dim attributedString As NSAttributedStringMBS = NSAttributedStringMBS.attributedStringWithAttachment(imageAttachment)

// insert image
Dim textView As NSTextViewMBS = TextArea1.NSTextViewMBS
textview.insertText attributedString

See also:

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


The biggest plugin in space...