Re: NSTextField / NSSecureTextField toggl
Re: NSTextField / NSSecureTextField toggl
- Subject: Re: NSTextField / NSSecureTextField toggl
- From: Jens Alfke <email@hidden>
- Date: Sun, 07 Jul 2013 09:50:13 -0700
On Jul 7, 2013, at 5:46 AM, Michael Starke <email@hidden> wrote:
> I'm somewhat heading down a road of pain with this. Maybe I approach the problem from the wrong angle, so I wanted to ask for advice.
> My goal is to have a NSTextField that can be toggled to display a Password in clear or bulleted format. Sort of NSTextField - NSSecureTextField
> I'm using a custom NSTextFieldCell to get a different look of the cell and also to add a toggle Button inside the Field.
I would avoid this complexity by simply having two views — a regular text field and a secure text field — at the same place in the window and swapping them out so one of them is hidden and the other visible. When you toggle which view is hidden, get the text from the old view and put it into the new view.
I don’t think messing with or trying to duplicate NSSecureTextField is a good idea. There is more to it than simply drawing bullets instead of characters. For instance, IIRC it does some magic with the window-server and event system to prevent other software (via the accessibility APIs?) from eavesdropping on the keystrokes.
—Jens
_______________________________________________
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