Author Topic: Password fields don't respect line width  (Read 2953 times)

ryan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 90
    • View Profile
Password fields don't respect line width
« on: November 09, 2012, 05:12:43 PM »
I'm seeing odd behavior using a password UIInput with a UILabel that has a line width set.  While entering text into the field, it seems to try to respect the line width, but it does so inconsistently.  The number of stars will increase or decrease as I enter characters, and sometimes the input carat will disappear and later reappear as I'm typing.  When the input loses focus, the label just shows the full number of stars, ignoring the line width completely.

This is with 2.2.3 on unity 3.5.6.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Password fields don't respect line width
« Reply #1 on: November 09, 2012, 05:45:00 PM »
Double-check to make sure you've set it up correctly. Try creating a new input field. I use one in Windward for the password field and it works as I'd expect (just tried it to triple-check).

ryan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 90
    • View Profile
Re: Password fields don't respect line width
« Reply #2 on: November 09, 2012, 10:35:52 PM »
I don't see anything obviously wrong, and I did try creating a new input.  I've got some simple repro steps:

Import NGUI into a fresh project and open scene "Tutorial 9 - Input".
Select UI Root (2D)/Camera/Anchor/Panel/Input/UISlicedSprite and check the "Is Password" box on the UIInput component.
Press Play, click in the "You can type here" input, and hold down the period key until the password field overflows.

With this specific case, the stars will flow out the right side of the box for a little while, but eventually it snaps the carat to the right side of the box and the stars overflow the left end of the box.  At this point it does seem to be limiting the number of characters it's showing, but there are still too many.  When I hit return to finish the input, it looks like it shows all characters without limiting the length at all.

Another case in this same scene: select the UILabel with the big, multi-paragraph chunk of text.  Remove the first newline so that first line of text gets wrapped.  Check the password box on the label.  When I do this I see it limit the label to one line, but it still exceeds the line width.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Password fields don't respect line width
« Reply #3 on: November 10, 2012, 11:35:26 AM »
You forgot to limit by the number of characters on the UIInput itself.

However, that said, I do see that it's using the width of the original characters instead of the width of the stars to determine what gets cut. I'll get that fixed.

ryan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 90
    • View Profile
Re: Password fields don't respect line width
« Reply #4 on: November 11, 2012, 11:47:55 PM »
I think there are two separate bugs here.  One with UIInput when the user is entering text, but another with UILabel that occurs even when inputs are not involved (the last example that I mentioned in my previous post).  That one's not just a matter of using the width of the original string instead of the width of the stars.  I can create a label with a string that far exceeds the line width, but as soon as I click the password box, it displays a star for every single character.

And I didn't forget to limit the number of characters on the UIInput.  My understanding was that the number of characters the user could enter was completely independent of how many should be displayed.  I hope I didn't misunderstand the intent of that property, because we're using that functionality elsewhere, and it works great with non-password fields.  :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Password fields don't respect line width
« Reply #5 on: November 12, 2012, 11:05:11 AM »
They are independent to a degree... max chars is just that -- you can't have more than that. So if you have an input field with max of 4 characters, you can have ABCD in it, and when you try entering E, it won't have any effect. If it's a password field, you'd see **** -- the number of stars matching the number of characters underneath.