• 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: custom NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom NSTextView


  • Subject: Re: custom NSTextView
  • From: "Parrish Myers" <email@hidden>
  • Date: Sun, 14 May 2006 14:54:43 -0700

Thank you for the response.  I'm still a bit confused though...  is
this inside the NSTextView instance (that is the field editor) or
outside in a NSTextField subclass?  Either way, which function or
delegate is the correct place to put this?

Thank you.

On 5/14/06, Andrew Bowman <email@hidden> wrote:



On May 14, 2006, at 9:39 AM, Parrish Myers wrote:

Hello all,

Just for fun, I thought I would try to implement an IP Address Text Field
entry.  Remember the IP text entry widget in windows...  So the idea is to
have 4 fields separated by '.' and only allow text selection inside each
field.


From what I understand this is a good reason to subclass NSTextView and swap out the FieldEditor for the NTTextField when asked. I'm getting the hand of things, but I can't seem to figure out one thing...

Much like the NSDatePicker, I want to modify the  text selection when the
widget  reacts to becomeFirstResponder.  But is seems that NSTextFields
select all text when they become First Responder.  Can I change that?  The
NSDatePicker does it somehow... does any one know how to change that?

Thanks.
Parrish



You're going to need to grab the field editor and make a setSelectedRange
call with an empty range starting at the end of the text.  After you've
obtained the field editor, it's something like this:

      [fieldEditor setSelectedRange: NSMakeRange([[self stringValue]
length], 0)];

- Andrew Bowman

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >custom NSTextView (From: "Parrish Myers" <email@hidden>)
 >Re: custom NSTextView (From: Andrew Bowman <email@hidden>)

  • Prev by Date: Re: Undefined symbols error in deployment build
  • Next by Date: Re: Using Fix and Continue with Object Alloc
  • Previous by thread: Re: custom NSTextView
  • Next by thread: Re: custom NSTextView
  • Index(es):
    • Date
    • Thread