• 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: "Clark Cox" <email@hidden>
  • Date: Fri, 21 Dec 2007 12:38:09 -0500

On Dec 21, 2007 1:31 AM, Jerry Krinock <email@hidden> 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.

No, the selected range and the insertion point are the same thing. If
it has zero length, it shows up as a blinking vertical line, and if it
doesn't, then it appears as a highlighted range of text.

--
Clark S. Cox III
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: Shadow Scaling
  • Next by Date: double-vision?
  • Previous by thread: Re: NSTextField: How to DEselect text?
  • Next by thread: NSTask setStandardOutput bug?
  • Index(es):
    • Date
    • Thread