Re: Custom field editor on NSSecureTextField?
Re: Custom field editor on NSSecureTextField?
- Subject: Re: Custom field editor on NSSecureTextField?
- From: "John Stiles" <email@hidden>
- Date: Mon, 16 Jun 2008 18:38:41 -0700
I had previously done everything with a formatter and there were some
limitations. I don't remember the exact details now, because it was several
months ago. I do remember that it was a lot better overall when I just used
my own field editor for everything. (If nothing else, it was simpler because
I wanted the same hooks on NSTextView.)
I will probably need to use an NSFormatter and the NSTextField delegate
methods, which is a disappointment, because it means I'm going to have to
write code to do the exact same thing in two totally different ways. Bummer.
Hopefully I can probably go back in source control and dredge up my old code
and try to repurpose it.
On Mon, Jun 16, 2008 at 6:29 PM, Nick Zitzmann <email@hidden> wrote:
>
> On Jun 16, 2008, at 7:16 PM, John Stiles wrote:
>
> I've got some code which subclasses NSTextView in order to provide a
>> custom
>> field editor for NSTextFields. It doesn't do anything too extraordinary,
>> just allows for filtering out some characters, watching for certain events
>> (like deleting characters or changing the selection), etc. It all works
>> quite well.
>> Now, it looks like I need to do the same thing with an NSSecureTextField.
>> Now, digging around, it looks like its field editor is an
>> NSSecureTextView--which isn't documented or in the headers, AFAICS. Since
>> it's undocumented, I don't think there is a way I can subclass it.
>>
>> So is it just not possible to customize the field editor for a secure text
>> field? :|
>>
>
>
> Well, you could write your own header for the class and then subclass it,
> but then you'll have to work whatever magic is necessary to get
> NSSecureTextField to actually use it, since
> -windowWillReturnFieldEditor:toObject: isn't called for special text fields.
> That includes NSTokenField, which also uses its own special & private field
> editor.
>
> Ultimately, though, this is really hackey and probably shouldn't be done.
> You can, however, do what you're trying to do with an NSFormatter subclass
> instead.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>
_______________________________________________
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