• 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: NSTextField / NSSecureTextField toggl
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField / NSSecureTextField toggl


  • Subject: Re: NSTextField / NSSecureTextField toggl
  • From: Michael Starke <email@hidden>
  • Date: Sun, 07 Jul 2013 15:24:55 +0200

Well,

turns out you can use NSString's:

- (void)enumerateSubstringsInRange:options:usingBlock:

Using the NSStringEnumerationByComposedCharacterSequences option, you get the actual character count. But that's just a little bit nearer to the solution, as I'm guessing I need to intervene earlier to prevent the glyph count to got to hight.

-Michael

On 07.07.2013, at 14:46, Michael Starke <email@hidden> wrote:

> Hello List,
>
> 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.
>
> The drawing of the actual control is easy. As I can use a NSSecureTextField cell to draw hidden, and my normal cell to draw unhidden passwords.
>
> The point where I'm struggling is the field editor.
>
> My solutions (with none working fully)
>
>
> #1 Use a NSSecureTextField and supply a standard NSTextView Field editor to display plain text
> That's not working, as NSSecureTextField demands a NSSecureTextField as it's field editor. So the only way would be to subclass private API and buble all calls up to NSTextView's implementation.
>
> #2 Use a NSTextField and supply a custom FieldEditor that can draw bullets like the NSSecureTextField can.
>
> This leads to a custom NSLayoutManager and then the problems start.
>
> I tried supplying my own implementation of
>
> - (NSUInteger)getGlyphsInRange:(NSRange)glyphRange
>                        glyphs:(NSGlyph *)glyphBuffer
>              characterIndexes:(NSUInteger *)charIndexBuffer
>             glyphInscriptions:(NSGlyphInscription *)inscribeBuffer
>                   elasticBits:(BOOL *)elasticBuffer
>                    bidiLevels:(unsigned char *)bidiLevelBuffer;
>
> - (void)drawGlyphsForGlyphRange:(NSRange)glyphsToShow atPoint:(NSPoint)origin
>
> but I'm having difficulties with custom fonts, like if someone uses emojis I'm unable to get the correct character count, as emojis consist of 2bytes, not 1. The string length gets reported with
> 2. And the drawing is done a bit lower than the normal bullets.
>
> I'm beginning to think, that I'm at a very low level – even too low – and this problem can be dealt with at much higher points, but thus far I've not found a way to do it.
>
> Maybe I should spent some weeks digging through al the text system documentation :-(
>
> #3 An NSTabView with the two input fields side by side and just toggle them back and forth.
> Might be the easy way out but it seemed so overblown to use so many views for this "simple" problem. Maybe it's the simples solution altogether.
>
>
> -Michael
>
>
> ___m i c h a e l   s t a r k e____
>       geschäftsführer
>       HicknHack Software GmbH
>       www.hicknhack-software.com
>
> ___k o n t a k t____
>       +49 (170) 3686136
>       email@hidden
>
> ___H i c k n H a c k   S o f t w a r e   G m b H____
>       geschäftsführer - maik lathan | andreas reischuck | michael starke
>       bayreuther straße 32
>       01187 dresden
>       amtsgericht dresden HRB 30351
>       sitz - dresden
>
>
> _______________________________________________
>
> 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


___m i c h a e l   s t a r k e____
       geschäftsführer
       HicknHack Software GmbH
       www.hicknhack-software.com

___k o n t a k t____
       +49 (170) 3686136
       email@hidden

___H i c k n H a c k   S o f t w a r e   G m b H____
       geschäftsführer - maik lathan | andreas reischuck | michael starke
       bayreuther straße 32
       01187 dresden
       amtsgericht dresden HRB 30351
       sitz - dresden


_______________________________________________

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


References: 
 >NSTextField / NSSecureTextField toggl (From: Michael Starke <email@hidden>)

  • Prev by Date: NSTextField / NSSecureTextField toggl
  • Next by Date: Re: NSTextField / NSSecureTextField toggl
  • Previous by thread: NSTextField / NSSecureTextField toggl
  • Next by thread: Re: NSTextField / NSSecureTextField toggl
  • Index(es):
    • Date
    • Thread