Re: selectText of NSTextField on focus
Re: selectText of NSTextField on focus
- Subject: Re: selectText of NSTextField on focus
- From: Joel Norvell <email@hidden>
- Date: Mon, 06 Jul 2015 23:49:10 +0000 (UTC)
Hi Richard,
When the instance of your NSTextField subclass becomes first responder, you have access to the NSText object (the field editor) and I believe you can use its methods to select the text. (I don't see why you can't, but since I haven't tried it myself, I'm saying "I believe.")
Sincerely,Joel
Override - (BOOL)becomeFirstResponder in your subclass.
Get the field editor:
NSText * itsText = [[self window] fieldEditor:YES forObject:self];
Use -selectAll or -setSelectedRange
_______________________________________________
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