On Sat, Jan 8, 2011 at 2:03 PM, Luc Van Bogaert <luc.van.boga...@me.com> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to