On May 19, 2009, at 10:35 PM, Dong Feng wrote:
Thanks Michael and Gideon's reply. [NSTextInput markedRange] works.

A minor question is that [NSWindow fieldEditor] returns an NSText*,
rather than an NSTextView*. I think that's because of historical
reason and it should be safe to always cast a returned NSText point to
an NSTextView. Is it safe?

I don't know if it's safe 100% of the time, but if you do it, drop an assert in your code for sanity's sake:

NSAssert( [returnedFieldEditor isKindOfClass:[NSTextView class]] == YES, @"Field editor is, in fact, an NSTextView." );

-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."
_______________________________________________

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