• 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: selectText of NSTextField on focus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: selectText of NSTextField on focus
      • From: Richard Charles <email@hidden>
  • Prev by Date: Re: selectText of NSTextField on focus
  • Next by Date: Unable to connect IBOutlet in Swift Xcode 7b2
  • Previous by thread: Re: selectText of NSTextField on focus
  • Next by thread: Re: selectText of NSTextField on focus
  • Index(es):
    • Date
    • Thread