Author Topic: UIInput Keyboard  (Read 3988 times)

vip_prizrak_3

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
UIInput Keyboard
« on: May 20, 2013, 06:48:54 AM »
Hi.
I have problem with UIInput.
When I enter the text and click hide the keyboard the text is not stored, uiinput is empty. Text is saved only if press Ok or Done.
In previous version it was ok.
« Last Edit: May 20, 2013, 06:56:45 AM by vip_prizrak_3 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput Keyboard
« Reply #1 on: May 20, 2013, 09:31:39 AM »
Hiding the keyboard is like canceling input by hitting escape. It goes back to what it was before. If you had text, it will go back to that text. If you had nothing, it will return to nothing. The way it is right now is how it should be, and if it wasn't like this before then that's a bug. If you don't like this behaviour, you can modify your UIInput's Update function. It's this part right here:

  1.                         string text = mKeyboard.text;
  2.  
  3.                         if (mText != text)
  4.                         {
  5.                                 mText = "";
  6.  
  7.                                 for (int i = 0; i < text.Length; ++i)
  8.                                 {
  9.                                         char ch = text[i];
  10.                                         if (validator != null) ch = validator(mText, ch);
  11.                                         if (ch != 0) mText += ch;
  12.                                 }
  13.  
  14.                                 if (maxChars > 0 && mText.Length > maxChars) mText = mText.Substring(0, maxChars);
  15.                                 if (mText != text) mKeyboard.text = mText;
  16.                                 UpdateLabel();
  17.                                 SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
  18.                         }
I'm pretty sure if you remove it, it's going to return to how it was before.

vip_prizrak_3

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
Re: UIInput Keyboard
« Reply #2 on: May 21, 2013, 02:49:26 AM »
Thanks.