From 13d7a18c5bbc6f882a1850dfa7afb05ee643aa6a Mon Sep 17 00:00:00 2001 From: Kunyi Li <55105630+kunyli@users.noreply.github.com> Date: Fri, 25 Mar 2022 19:34:17 -0400 Subject: Fixed changed handler to detect password autofilled using Apple Keychain and text field wrapping to prevent long passwords appearing as multiple lines (#1098) --- Xwt.XamMac/Xwt.Mac/PasswordEntryBackend.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Xwt.XamMac/Xwt.Mac/PasswordEntryBackend.cs b/Xwt.XamMac/Xwt.Mac/PasswordEntryBackend.cs index 5e1a74a5..fe25c64c 100644 --- a/Xwt.XamMac/Xwt.Mac/PasswordEntryBackend.cs +++ b/Xwt.XamMac/Xwt.Mac/PasswordEntryBackend.cs @@ -40,7 +40,12 @@ namespace Xwt.Mac public override void Initialize () { base.Initialize (); + var view = new CustomSecureTextField (EventSink, ApplicationContext); + view.Cell.UsesSingleLineMode = true; + view.Cell.Scrollable = true; + view.Cell.Wraps = false; + ViewObject = new CustomAlignedContainer (EventSink, ApplicationContext, (NSView)view) { DrawsBackground = false }; } @@ -109,6 +114,7 @@ namespace Xwt.Mac this.context = context; this.eventSink = eventSink; Activated += (sender, e) => context.InvokeUserCode (eventSink.OnActivated); + Changed += (sender, e) => context.InvokeUserCode (eventSink.OnChanged); } public NSView View { @@ -118,12 +124,6 @@ namespace Xwt.Mac } public ViewBackend Backend { get; set; } - - public override void DidChange (NSNotification notification) - { - base.DidChange (notification); - context.InvokeUserCode (eventSink.OnChanged); - } } } -- cgit v1.2.3