Solved

Change hardware keyboard layout from CF.net

Posted on 2008-06-26
5
2,157 Views
Last Modified: 2013-12-27
Hi

I'm developing a CF.Net application.
In it I have several textboxes for numeric input only.

The problem is that when ever the user uses the hardware keyboard (which has a 10 digit numeric layout), it always inserts text into the textbox...
Eg. typing 3 inserts a 'd'

I have tried....
InputModeEditor.SetInputMode(this.txtSomeNumber, InputMode.Numeric);
... It does not work.

Though, if the users holds down the * a small list appears, where the users can choose between T9, ABC or 123 (Numeric)
If the user chooses 123, then the hardware keyboard inputs numeric values.

I want to be able to programmatically set the hardware keyboard to 123 or ABC
There has to be some p/invoke or likewise that can do this.... but how?

Details...
Device: HP iPaq 614c
OS: Windows Mobile 6 Professional
Runtime: Compact Framework 2.0

Thank you!
0
Comment
Question by:tarasbredel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 21882772
0
 

Author Comment

by:tarasbredel
ID: 21882886
Hi Mikal

SIP = software-based input panel
The link you sent me is how to show/hide the SIP, and which InputMethods it has.

Even though I change the SIP to be numeric, it does not effect the hardware-based keyboard, which is still alpha.

I need to change to output from the hardware-based keyboard to numeric.

//Taras
0
 

Accepted Solution

by:
tarasbredel earned 0 total points
ID: 21924170
Here is the solution....

On GotFocus of the textbox call SetKeyboardNumeric()
On LostFocus of the textbox call SetKeyboardNormal()


        public void SetKeyboardNumeric()
        {
            Process p = Process.GetCurrentProcess();
            if (p.MainWindowHandle != IntPtr.Zero)
                SHSetImeMode(p.MainWindowHandle, SHIME_MODE.SHIME_MODE_NUMBERS);
        }
 
        public void SetKeyboardNormal()
        {
            Process p = Process.GetCurrentProcess();
            if (p.MainWindowHandle != IntPtr.Zero)
                SHSetImeMode(p.MainWindowHandle, SHIME_MODE.SHIME_MODE_NONE);
        }
 
        private enum SHIME_MODE
        {
            SHIME_MODE_NONE = 0,
            SHIME_MODE_SPELL = 1,
            SHIME_MODE_SPELL_CAPS = 2,
            SHIME_MODE_SPELL_CAPS_LOCK = 3,
            SHIME_MODE_AMBIGUOUS = 4,
            SHIME_MODE_AMBIGUOUS_CAPS = 5,
            SHIME_MODE_AMBIGUOUS_CAPS_LOCK = 6,
            SHIME_MODE_NUMBERS = 7,
            SHIME_MODE_CUSTOM = 8
        }
 
        [DllImport("aygshell.dll")]
        private static extern int SHSetImeMode(IntPtr hWnd, SHIME_MODE nMode);

Open in new window

0
 

Expert Comment

by:pentium10
ID: 22168280
I tried the above code on a Treo750 device within an application running Windows Mobile 6 and had no success.  Do you know a working solution?
0
 

Author Comment

by:tarasbredel
ID: 22257613
It works for me on 2 different model (Asus and HP)
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IPC$ Password 13 48
using interface in TLB 3 29
Windows updates using WSUS 2 28
Missing Items from Styles Menu, in Word 2016 5 41
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This article summaries thoughts and ideas from two years of sustained use. It provides good reasoning to make the jump to Windows 10.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question