• 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: NSTextField: How to DEselect text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField: How to DEselect text?


  • Subject: Re: NSTextField: How to DEselect text?
  • From: John Stiles <email@hidden>
  • Date: Fri, 21 Dec 2007 08:48:41 -0800

Actually, an insertion point is just a zero-length selection.

Jerry Krinock wrote:

On 2007 Dec, 20, at 22:12, Shripada Hebbar wrote:

[mWindow makeFirstResponder:mTextField];
//Get hold of the field editor and deselect its text
NSText* fieldEditor = [mWindow fieldEditor:YES forObject:mTextField];
[fieldEditor setSelectedRange:NSMakeRange([[fieldEditor string] length],0)];
[fieldEditor setNeedsDisplay:YES];

Thank you, Shripada. I just figured this out after considering John's reply.


The location member of the range passed to setSelectedRange should be set to the end of the string, as you have done. At first I set the range to {0,0}, but that put the insertion point at the ^beginning^ of the text, which was another ARGHHHH, because there ain't no -setInsertionPoint in any of the related classes.

Apparently, the insertion point is always set to the ^end^ of the selectedRange.

All works now.  Thanks.
_______________________________________________

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
_______________________________________________

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: 
 >Re:NSTextField: How to DEselect text? (From: Shripada Hebbar <email@hidden>)
 >Re: NSTextField: How to DEselect text? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Opacity of Menus
  • Next by Date: Re: NSTextField Size
  • Previous by thread: Re: NSTextField: How to DEselect text?
  • Next by thread: Re: NSTextField: How to DEselect text?
  • Index(es):
    • Date
    • Thread