• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Avoid selection of text in NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Avoid selection of text in NSTextField (From: Luc Van Bogaert <email@hidden>)

  • Prev by Date: Re: NSUndoManager retain/release of arguments - ad infinitum
  • Next by Date: Re: NSUndoManager retain/release of arguments - ad infinitum
  • Previous by thread: Avoid selection of text in NSTextField
  • Next by thread: NSUndoManager retain/release of arguments - ad infinitum
  • Index(es):
    • Date
    • Thread