Mon, August 8, 2005, 12:25 PM under
MobileAndEmbedded
Everybody knows that to show the Soft Input Panel on a WindowsCE device you have to use the
Microsoft.WindowsCE.InputPanel
(set the
Enabled
property to true/false to show/hide).
A common request, to which there is no clean answer, is to show the SIP in numeric mode or not so the user doesn't have to do it.
However,
Alex Feinman has a great hack that provides just that; it checks for the color of the "123" button and sends a windows message depending on if it is black or white (pressed or not). Go
download it here.
If you are targeting PocketPCs then use it and that is the end of the story, see you next time.
If you are targeting custom Windows CE devices, you need to make a few small changes (on our platform we are using the small keyboard with the "Large Keys"):
1. The calls to
GetPixel/SetPixel
take the X,Y coordinates which are hard coded to 2,2. Change the Y to be 77.
2. Change the last parameter in the two calls to
Message.Create
to be: new IntPtr(0x00490009).
3. Change the condition so it caters for showing a numeric sip in non-numeric mode.
I've wrapped the changes in an
InputPanelEx class:
a) In your projects replace all occurrences of
InputPanel
to
InputPanelEx
.
b) Wherever you have
inputPanel1.Enabled = true
, add another line
inputPanel1.Show(true)
[if you want to show numeric SIP].