Author Topic: UIInput still not bringing up keyboard on Windows Store. Backspace not working.  (Read 14994 times)

pdelaossa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Same thing for me using 4.6.
Absolutely not showing the keyboard on a Surface Pro device :(

I already posted a hack in this very same thread, less than 10 posts behind.

The problem that is still not solved (or hacked) is that Backspace and arrow keys don't work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I am pretty sure if you don't check "hide input" it should all work as expected. There are a lot of hacks that go into hiding input on mobile/metro devices.

I don't quite understand your hack, pdelaossa. 'mKeyboard' should already exist at that point, so why do you re-open it, and with null of all things? Would simply changing OnPress to this work?:
  1.         protected virtual void OnPress (bool isPressed)
  2.         {
  3.                 if (isPressed && isSelected && label != null &&
  4.                         (UICamera.currentScheme == UICamera.ControlScheme.Mouse ||
  5.                          UICamera.currentScheme == UICamera.ControlScheme.Touch))
  6.                 {
  7.  #if UNITY_METRO
  8.                         if (mKeyboard != null) mKeyboard.active = true;
  9.  #endif
  10.                         selectionEnd = GetCharUnderMouse();
  11.                         if (!Input.GetKey(KeyCode.LeftShift) &&
  12.                                 !Input.GetKey(KeyCode.RightShift)) selectionStart = mSelectionEnd;
  13.                 }
  14.         }

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Hey pdelaossa,


Your hack absolutely does not work on a Surface Pro.
With the Surface Pro, there is just no possible use of the TouchScreenKeyboard (it seems). I've tried TouchScreenKeyboard.isSupported with Unity 4.6 and it returns false on a Surface Pro... that means what it means right? Not touchscreen support from Unity on this device.


Did your hack really work on a Surface Pro? The keyboard really show up?


Also #if UNITY_METRO does not work on the SurfacePro...
Are you building with Standalone?

dttngan91

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
I have the same issue on Android devices. It doesn't show up keyboard sometimes I press (onPress called), just display the carpet. :(

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I don't recommend using the 'hide input' feature for the time being.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Hi again,


I'm debugging things right now.
The solution I will use (and is working with Unity new UI) only need one thing, it's the focus on the input field. I will show the virtual keyboard myself.


The thing is... the focus is not working when I touch the screen with my finger (but is working with the mouse). I'm trying to understand why but I have some difficulties.



I'm down to the UICamera.cs script, in the coroutine ChangeSelection.


Do you have any idea of what is causing this?

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Found the issue to gain focus!


It's in your coroutine ChangeSelection, I don't why, but it's the fact that you're doing "yield return new WaitForEndOfFrame();", by removing this, I have the focus and everything is working.
I just need to add a bit of custom code to launch the virtual keyboard on the Surface Pro, that is:
  1. System.Diagnostics.Process keyboardProcess = new System.Diagnostics.Process();
  2. keyboardProcess.StartInfo = new System.Diagnostics.ProcessStartInfo(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe");
  3. keyboardProcess.Start();


And because I have the focus, everything is working fine, typing, selecting, deleting text etc...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
That's strange. What if you change it to be "yield return null;" instead?

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
That's strange. What if you change it to be "yield return null;" instead?


Changing it to yield return null does not work.
What I've done is comment yield return new WaitForEndOfFrame and I call yield return null at the very end of the method.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Alright, I'll make the changes, thanks.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
No problem,
But just for info, it's not with the platform WP8 or something like that.
It's really just a Standalone Windows build, so no #if UNITY_WP8 or UNITY_METRO etc... :)