Author Topic: UIInput Max char - Mobile keyboards don't respect setting  (Read 2229 times)

cbartlett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 43
    • View Profile
UIInput Max char - Mobile keyboards don't respect setting
« on: July 12, 2013, 11:10:31 AM »
If an input maxChar is set to say 10 and on either an IOS or an android the users types more than 10 characters, the native input accepts it but the UIInput doesn't.  Is there any suggestion or ability to limit the keyboard input length?

cbartlett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 43
    • View Profile
Re: UIInput Max char - Mobile keyboards don't respect setting
« Reply #1 on: July 12, 2013, 12:10:02 PM »
For those that are interested, if you change the order of two lines of code, it works
UIInput.cs ~ln 320 Function Update()

  1. if (mText != text) mKeyboard.text = mText;
  2. UpdateLabel();

Switched to
  1. UpdateLabel();
  2. if (mText != text) mKeyboard.text = mText;
  3.  

What this does is UpdateLabel correctly sets the length of mText dependent on Max Chars.
Then you set that text back to the keyboard.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput Max char - Mobile keyboards don't respect setting
« Reply #2 on: July 12, 2013, 01:52:38 PM »
Thanks!