Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XNA show xbox onscreen keyboard in PC

I need to show, and input some text in xbox-like onscreen keyboard. Sadly, when I call Guide.BeginShowKeyboardInput, there is only some funny textbox shown, and i must fill it via keyboard. I know, that on PC iv very normal to use keyboard, but in my case i MUST enter text via gamepad, using xbox on screen keyboard.

Is there any way to achieve this? To call xbox onscreen keyboard on PC?

like image 797
Thaven Avatar asked Jan 29 '13 19:01

Thaven


4 Answers

If you need one for like a touchscreen monitor you could do

 using System.Diagnostics;
 using System.IO;

then use this function

  Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + Path.DirectorySeparatorChar + "osk.exe");

but if you need it to work with like an xbox controller you will probably need to build your own

like image 102
Shredder2500 Avatar answered Oct 22 '22 11:10

Shredder2500


No. It was a design decision (documented here) to give the end user control of the keyboard being invoked. Therefore, the end user has to touch a text box (or the like) to invoke the virtual on-screen keyboard.

Check this text form this link

Blockquote User-driven invocation The invocation model of the touch keyboard is designed to put the user in control of the keyboard. Users indicate to the system that they want to input text by tapping on an input control instead of having an application make that decision on their behalf. This reduces to zero the scenarios where the keyboard is invoked unexpectedly, which can be a painful source of UI churn because the keyboard can consume up to 50% of the screen and mar the application's user experience. To enable user-driven invocation, we track the coordinates of the last touch event and compare them to the location of the bounding rectangle of the element that currently has focus. If the point is contained within the bounding rectangle, the touch keyboard is invoked.

Blockquote This means that applications cannot programmatically invoke the touch keyboard via manipulation of focus. Big culprits here in the past have been webpages—many of them set focus by default into an input field but have many other experiences available on their page for the user to enjoy. A good example of this is msn.com. The website has a lot of content for consumption, but happens to have a Bing search bar on the top of its page that takes focus by default. If the keyboard were automatically invoked, all of the articles located below that search bar would be occluded by default, thus ruining the website's experience on tablets. There are certain scenarios where it doesn't feel great to have to tap to get the keyboard, such as when a user has started a new email message or has opened the Search pane. However, we feel that requiring the user to tap the input field is an acceptable compromise.

like image 29
Rusty Mcpherson Avatar answered Oct 22 '22 13:10

Rusty Mcpherson


Check out: http://classes.soe.ucsc.edu/cmps020/Winter08/lectures/controller-keyboard-input.pdf
You might find your answer in here, It has all information about the input of a gamepad and such.

like image 1
MX D Avatar answered Oct 22 '22 12:10

MX D


There is a good guide on how to do this here:

static public string GetKeyboardInput() 
{ 
    if (HandleInput.currentState.IsButtonDown(Buttons.B)) 
    { 
        useKeyboardResult = false; 
    } 

    if (KeyboardResult == null && !Guide.IsVisible) 
    { 
         string title = "Name"; 
         string description = "Pick a name for this game"; 
         string defaultText = "Your name here"; 

         pauseType = PauseType.pauseAll; 
         KeyboardResult = Guide.BeginShowKeyboardInput(HandleInput.playerIndex, title, 
                                                       description, defaultText, null, null); 

         useKeyboardResult = true; 
         pauseType = PauseType.pauseAll; 

     } 
     else if (KeyboardResult != null && KeyboardResult.IsCompleted) 
     { 
          pauseType = PauseType.none; 
          KeyboardInputRquested = false; 

          string input = Guide.EndShowKeyboardInput(KeyboardResult); 
          KeyboardResult = null; 

          if (useKeyboardResult) 
          { 
               return input; 
          } 
     } 

     return null; 
} 

And your Update method should contain something like this:

if (KeyboardInputRequested) 
{ 
    string result = GetKeyboardInput(); 
} 

if (result != null) 
{ 
    //use result here 
} 
like image 1
CC Inc Avatar answered Oct 22 '22 11:10

CC Inc