• 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: Advice on restricting/monitoring character input in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advice on restricting/monitoring character input in NSTextView


  • Subject: Re: Advice on restricting/monitoring character input in NSTextView
  • From: Greg Herlihy <email@hidden>
  • Date: Tue, 07 Feb 2006 17:04:06 -0800
  • Thread-topic: Advice on restricting/monitoring character input in NSTextView

The usual way to validate character input is to create a subclass of
NSFormatter and implement

   isPartialStringValid:newEditingString:errorDescription:

To decide whether to accept each character as the user types. Similarly,

isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRa
nge:errorDescription:

Lets the program pre-approve larger changes, such as when the user pastes
text into the field.

Greg

On 2/7/06 3:37 PM, "Scott Lehman" <email@hidden> wrote:

> Thanks.  I'll give an NSTextView subclass a try next.
> I was hoping to be able to have all the filtering in
> just one function, but I think I see how to have it
> all in the subclass at least, which is good enough.
>
> Is it theoretically possible to completely override
> NSTextView's
> shouldChangeTextInRange(s):replacementString(s): to
> catch both typing and pastes?  I'm guessing there's
> stuff in there I don't want to try duplicating - just
> trying to confirm my understanding of where text is
> flowing.
>
> Thanks for the heads up about pasting and
> lists/tables.  That is something I hope to work with.
>
> Scott
>

>
> This email sent to email@hidden


 _______________________________________________
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: 
 >Re: Advice on restricting/monitoring character input in NSTextView (From: Scott Lehman <email@hidden>)

  • Prev by Date: Re: a c question
  • Next by Date: Re: a c question
  • Previous by thread: Re: Advice on restricting/monitoring character input in NSTextView
  • Next by thread: Duplicate Address Book change notifications? (kABDatabaseChangedExternallyNotification)
  • Index(es):
    • Date
    • Thread