On 16 Oct 2009, at 20:51, I. Savant wrote:

On Oct 16, 2009, at 3:44 PM, I. Savant wrote:

I want to figure out a way to build a search predicate that will allow me to search a Text View and I think this is likely to be the only way.

Seems a bit odd. Could you elaborate?

Let *me* elaborate on *that*. :-) You normally use predicates to filter objects in the model layer of your application. Note "normally". If you're trying to provide a way to search within a text view, this is a very strange way of going about it:

1 - NSTextView already takes advantage of the Find field.

2 - Searching for a substring inside a string with a predicate searches the *whole* string as one ... this is only really useful if your text view's content is made up of a bunch of smaller units, but then again ... see 1 above.

3 - The predicate would be used to filter an array of NSTextStorages, not one NSTextStorage, returning those which contain your search string.

4 - Related to 3: if you're searching text storages because you treat them as individual subunits in your model, it would likely make more sense to apply this filter to the model layer.

I will elaborate...

I have a Core Data application that has a Text View in its main window, and also has a Find field. I want to create a search field predicate to allow the user to search the text in the Text View. I'm interested in point 1 above, because I initially thought it made sense for an NSTextView to just work with the Find field, but I couldn't seem to get it working. That is what led me to wondering whether I could get at the string content in the NSTextView and search that instead. I'm happy to just use the inherent capabilities of NSTextField but I can't figure out what they are!

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!


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