On 17 Oct 2009, at 00:46, Charles Srstka wrote:

On Oct 16, 2009, at 5:42 PM, Ian Piper wrote:

The Text View is simply used as a place for the user to put any rich text and or images. Is there a way either to search or to get all of the plain text out from such a Text View? It's probably a simplistic question and I rather suspect that ultimately the answer is no!

As others have already said, you can get the plain text by just sending the -string message to the NSTextStorage object.

Charles

Yes - I had read the other comments. However I am not sure that I am communicating the problem effectively here. I don't think I have an NSTextStorage object. I am trying to build a search predicate binding in the Bindings Inspector. I seem to be able to add predicates like this (to enable filtering of entities containing a String attribute called entryName):

entryName contains[c] $value

This works fine and so my find panel finds records in my database that have appropriate text in those attributes. The problem comes with another attribute called entryContent. This is expressed in the user interface as an NSTextView and displays content stored in an NSData attribute. I am trying to understand whether there is a filterpredicate format like the one above that I can add to enable finding records that contain the specified text in that entryContent attribute. I have tried things like

entryContent contains[c] $value

but this renders the find box useless.

It seems to me that the filterPredicates that you build in IB's Inspector are referring to the attributes in the data model rather than the objects in the user interface, so I suppose I need to understand how you get text data out of an NSData attribute using a filterPredicate.

Failing that, a colleague has suggested to me that I could create a new Managed Object, write a custom accessor method to get out the text and then use that method in the filterpredicate definition. That is where I have been trying to understand how to get a string object out of the NSData attribute. When I create a custom Managed Object class I see these in the .h and .m files respectively:

@property (nonatomic, retain) NSData * entryContent;

@dynamic entryContent;

However I don't seem to be able to get at the string content of entryContent.

I'm sure I am complicating this unduly, but if someone could just spell this out I'd be grateful. I have looked with increasing bafflement at the Developer Documentation.

Regards,


Ian.
--

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to