Re: Avoid selection of text in NSTextField
Re: Avoid selection of text in NSTextField
- Subject: Re: Avoid selection of text in NSTextField
- From: Kyle Sluder <email@hidden>
- Date: Sun, 9 Jan 2011 20:51:10 -0800
On Sat, Jan 8, 2011 at 2:03 PM, Luc Van Bogaert <email@hidden> wrote:
> I'm creating some kind of numerical keypad with several buttons that can be used to "insert" text (eg. a number) into a NSTextField.
> When I use such a button, the text gets inserted correctly, but the text in the field is automatically selected. I would like to avoid that, and have the NSTextField display a cursor instead, as if it was being edited manually. Could anyone provide some help on how to so this? Thank you!
Subclass NSTextField and handle -[<NSTextViewDelegate>
textView:willChangeSelectionFromCharacterRanges:toCharacterRanges:]
from the field editor?
Or just call -setSelectedRange: as part of the action of your button.
--Kyle Sluder
_______________________________________________
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