Re: Advice on restricting/monitoring character input in NSTextView
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