I am adding support for (Apple)Scripting to a Xojo app (and developing it as a library so that others can use it, too).
I like to support AppleScript’s “Text Suite”. For that, I need to work with Cocoa NSTextStorage objects.
I wonder if Xojo’s TextArea uses NSTextStorage under the hood, and if so, how do I access it.
Does someone know?
dim t as NSTextStorageMBS = textarea1.NSTextViewMBS.textStorage
should work with my plugins.
Yes, it does.
[code]Declare Function documentView Lib “Cocoa” Selector “documentView” (NSScrollView As Ptr) As Ptr
Declare Function textStorage Lib “Cocoa” Selector “textStorage” (NSTextView As Ptr) As Ptr
Dim documentViewPtr As Ptr = documentView(Ptr(textArea.Handle))
Dim textStoragePtr As Ptr = textStorage(documentViewPtr)[/code]
I ended up figuring this out myself, too, by using the great F-Script that allows me to inspect the views of a Cocoa app.