Re: How is "Apple + Ctrl + D" implemented?
Re: How is "Apple + Ctrl + D" implemented?
- Subject: Re: How is "Apple + Ctrl + D" implemented?
- From: John Stiles <email@hidden>
- Date: Tue, 29 Apr 2008 13:36:57 -0700
Man, what a bummer. I wish you had been around when I asked the question
before :)
Keith Blount wrote:
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