I’m currently working on a game, and in one place I need to enter Player’s name. I made whole custom Textbox and all, but I’m struggling now with getting on-screen keyboard to show.
Is there any way to do that?
I’m developing a iOS, Android and Windows 10 game, so it would be great if there was a one way to do that, but if there is not - please help me with all three.
Well, thank you for your response, but that’s not exactly what I was hoping to do.
What I need to do is just to show keyboard whitout showing enything else. I want player to enter his name, I catch everything he types and show it on my custom TextBox. I just want to show him a keyboard, because without it he can’t type anything…
Maybe there is platform-specific methods to do so.
I found (and it works) method (Windows.UI.ViewManagement) InputPane.GetForCurrentView().TryShow(); which do exactly what I wanted on Windows 10. But can’t find simmilar methods for iOS and Android.
I was also researching how to do this, but I found that showing and hiding the keyboard to work with “custom controls” was not easy (maybe impossible?)
I found that it was much easier to fall back into native controls and allow them to be used to enter the input.
I know that’s not what you’re asking, but I just wasn’t able to figure out an easy way to do it.
Well, because I have custom Textbox (EditText etc.) with custom font, and custom behaviour (when it’s too big, font changes size to fit textbox) it is really time-consuming to make 3 custom controls for 3 platforms.
I figured, that I can show platform control “behind” my game with opacity 0.0 (just in case), focus it and show keyboard that way. Then I subscribe to “TextChanged” and view it in my game. When I don’t need it i just loose focus (and hide keyboard).
I realize that this is not very proffesional aproach, but it works… What do you think about this?
Did you get anywhere with this? If you did, would you be so kind as to share your implementation?
I’m in the same boat right now - I just tried BeginShowKeyboardDialog on the Android version of my game, and the actual text editor is hugely out of character with the rest of the GUI, so if you have already have a better way of doing this, I’d be very interested!
I was thinking about doing the same thing as you Prophet, and hiding an EditText. I have had problems with the softkeyboard without using the EditText. Can you share the Android code for how you achieved this, please?