• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AppleScript: providing rich text without the NSDocument framework
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript: providing rich text without the NSDocument framework


  • Subject: AppleScript: providing rich text without the NSDocument framework
  • From: Philip Dow <email@hidden>
  • Date: Sun, 5 Feb 2006 18:24:14 +0100

One of the objects in my data model stores rich text information as NSData. I would like to provide scripters access to this rich text, but I am running into difficulties. According to what I can find online, returning an instance of NSTextStorage should do the trick. Of course, it does not, as NSTextStorage does not respond to - objectSpecifier. So I've tried to subclass NSTextStorage and add a reference to its container (an instance of an object in my data model) while implementing the appropriate methods. Then, using a method of my object accessible via scripting, I return an instance of my text storage subclass, initiated with the rich text data my object stores.

Doing this, however, always results in a nil instance of my subclass. It's as though calling initWithRTFD:attributes: on my NSTextStorage subclass does not work. Is there something I'm missing with a subclass of NSTextStorage? If I call the exact same method on a regular instance of NSTextStorage, the object is allocated and initiated just fine. This, however, is not good enough for scripting, as the regular NSTextStorage does not implement -objectSpecifier or keep a reference to its container.

Apparently, the NSTextStorage from an NSTextView in an NSDocument instance can provide the sort of functionality I need without too much work on my part ( http://www.macdevcenter.com/pub/a/mac/ 2002/04/12/applescript.html ), but this is not a viable option for me, as my application is not document based.

Can anyone offer any suggestions or examples on providing rich text to scripters without going through NSDocument?

-Phil
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: NSOutlineView Row Selection Color
  • Next by Date: Re: NSOutlineView Row Selection Color
  • Previous by thread: Re: modal windows
  • Next by thread: getting visible character range
  • Index(es):
    • Date
    • Thread