Re: How is "Apple + Ctrl + D" implemented?
Re: How is "Apple + Ctrl + D" implemented?
- Subject: Re: How is "Apple + Ctrl + D" implemented?
- From: Keith Blount <email@hidden>
- Date: Tue, 29 Apr 2008 12:12:33 -0700 (PDT)
> Really? Does this actually work?
> I needed to find word boundaries to implement a Find panel which
> supports searching for "Whole Words" and I ended up using
> UCFindTextBreak based on advice from this list. It was a pain to
> implement (since it's not designed to mesh with Cocoa at all).
Yes, it works. I had to implement my own Find panel for various reasons, too, and I used -selectionRangeForProposedRange: for exactly that:
NSRangewordRange = [text selectionRangeForProposedRange:foundRange granularity:NSSelectByWord];
if(tag == FindTypeContains)
searchSuccess = YES;
else if ( (tag == FindTypeWholeWord) && (NSEqualRanges(foundRange,wordRange)) )
searchSuccess = YES;
else if ( (tag == FindTypeStartsWith) && (foundRange.location == wordRange.location) )
searchSuccess = YES;
else if ( (tag == FindTypeEndsWith) && (NSMaxRange(foundRange) == NSMaxRange(wordRange)) )
searchSuccess = YES;
Best,
Keith
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden