Reputation: 3726
How to have numeric keyboard popup to input in TextBox on Windows Mobile 6.53? (C++ vs2008)
When one clicks in a text box, the numeric keypad should popup - not the full keyboard.
I searched for other threads, but a solution does not seem to exist. (http://msdn.microsoft.com/en-us/library/dd183783(v=vs.90).aspx)
This code fails - it does not bring up the numeric keypad, but the full qwerty keyboard:
hwndCtl = GetDlgItem(hwndDlg, IDC_PASSWORD);
SHSetImeMode(hwndCtl, SHIME_MODE_NUMBERS);
This does not compile - it does not recognize Microsoft.WindowsCE.Forms (I am unable to find the header file to include for this, if it exists):
Microsoft.WindowsCE.Forms::InputModeEditor.SetInputMode(hwndCtl,Microsoft.WindowsCE.Forms.InputMode.Numeric);
error C2065: 'Microsoft' : undeclared identifier
Is there a way to do this without writing my own dialog?
Upvotes: 1
Views: 1516
Reputation: 3726
I ended up creating my own numeric keypad since I did not receive any replies for a long time.
Upvotes: 0
Reputation: 23886
You have the right idea, you're just missing the right import statement.
According to the documentation for InputModeEditor.SetInputMode:
Specifies the input mode on a Smartphone. ... You can set the input mode only on a TextBox.
Its example, however, is too terse. However, according to the documentation for InputModeEditor, here's what you need to do:
using Microsoft.WindowsCE.Forms;
...
hwndCtl = GetDlgItem(hwndDlg, IDC_PASSWORD);
InputModeEditor.SetInputMode(hwndCtl,InputMode.Numeric);
To access members from the namespace you desire, you have to use it.
This documentation may also help you.
Upvotes: 2