On Jul 7, 2013, at 5:46 AM, Michael Starke 
<michael.sta...@hicknhack-software.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to