Re: NSTextField: How to DEselect text?
Re: NSTextField: How to DEselect text?
- Subject: Re: NSTextField: How to DEselect text?
- From: John Stiles <email@hidden>
- Date: Fri, 21 Dec 2007 08:48:41 -0800
Actually, an insertion point is just a zero-length selection.
Jerry Krinock wrote:
On 2007 Dec, 20, at 22:12, Shripada Hebbar wrote:
[mWindow makeFirstResponder:mTextField];
//Get hold of the field editor and deselect its text
NSText* fieldEditor = [mWindow fieldEditor:YES forObject:mTextField];
[fieldEditor setSelectedRange:NSMakeRange([[fieldEditor string]
length],0)];
[fieldEditor setNeedsDisplay:YES];
Thank you, Shripada. I just figured this out after considering John's
reply.
The location member of the range passed to setSelectedRange should be
set to the end of the string, as you have done. At first I set the
range to {0,0}, but that put the insertion point at the ^beginning^ of
the text, which was another ARGHHHH, because there ain't no
-setInsertionPoint in any of the related classes.
Apparently, the insertion point is always set to the ^end^ of the
selectedRange.
All works now. Thanks.
_______________________________________________
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
_______________________________________________
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