... 2 down vote accepted. Look at the Input Method Kit Framework Reference and the sample code.
stackoverflow.com