Changing the keyboard layout on Windows Mobile

The app has a dialog box where only numeric string entries are valid. So I would like to set the numeric keyboard layout.

Does anyone know how to simulate a key press on the keyboard, or any other way to change the keyboard layout?

Thank!

+1


source to share


3 answers


You do not need.

As with full windows, you can set the edit control to be numeric only. You can either do it manually or in the dialog editor in the properties for the edit control.



The SIP should automatically display the numeric keypad when the numeric edit control comes into focus.

+2


source


You can use InputModeEditor:



InputModeEditor.SetInputMode(textBox1,InputMode.Numeric);

      

0


source


There is only one way to do this (edit: this refers to SIP in a non-Windows Mobile smartphone, so I'm not sure if this is relevant to your question) and it has to do with simulating a mouse click on 123. This is only half the problem, however, as you also need to know if the keyboard is already in numeric mode or not. The way to do this is to look into the pixel near the upper left corner of the keyboard - if you look at how the 123 button works, you will see that it is the system text in the Windows background and then inverted in numeric mode (so the pixel will be the system text color only in numeric mode). There's one more bit of weirdness you have to do to ensure it works on all devices (you need to draw a pixel on the keyboard too).

Lucky for you, I have an easy-to-use example code that does all of this. Out of luck, it's in C #, but I think it should at least point you in the right direction.

0


source







All Articles