Page 1 of 1

How to use PasswordBox on Android?

Posted: 19 May 2014, 14:35
by Kristof
Noesis (and WPF) provide a PasswordBox control to let the user enter a password.

In the Unity player (on Windows) this works perfectly, but on Android it doesn't:
* First of all, while typing all the characters are visible. Typically on Android, all the characters would be replaced by '*' except the last entered character which is displayed for a short time.
* But more importantly, the data that is entered by the user is never actually copied into the PasswordBox!

XAML code:
<PasswordBox PasswordChar="*" x:Name="_passwordBox"/>
Code-behind:
public LogInV()
{
    this.Loaded += LogInV_Loaded;
}

void LogInV_Loaded(BaseComponent sender, RoutedEventArgs e)
{
    _passwordBox = FindName<PasswordBox>("_passwordBox");
    if (_passwordBox == null)
    {
        _log.Log("_passwordBox not found");
        return;
    }

    _passwordBox.PasswordChanged += _passwordBox_PasswordChanged;
}

void _passwordBox_PasswordChanged(BaseComponent sender, RoutedEventArgs e)
{
    // THIS CODE WILL NEVER BE INVOKED ON ANDROID![/color]
    var password = _passwordBox.GetPassword();
    _log.Log("password changed: [" + password + "]");
}

Re: How to use PasswordBox on Android?

Posted: 20 May 2014, 12:42
by sfernandez
It was a bug, our script was not taking into account the PasswordBox type to open the TouchScreenKeyboard.
Please overwrite the script at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisGUISystem.cs with the one attached here and this issue will be solved.

Re: How to use PasswordBox on Android?

Posted: 27 May 2014, 12:01
by Kristof
Thanks for the fix, it now works as expected. I've noticed that this fix hasn't made it in the latest release (1.1.8), hopefully it will be in the next one. But for now my problem is solved.

Re: How to use PasswordBox on Android?

Posted: 27 May 2014, 12:05
by jsantos
Yes, it was too late to be included in v1.1.8. v1.1.9 will make it.

thanks!