Export (0) Print
Expand All

InputPanel.InputMethodCollection Class

Provides access to all input method software installed on a Pocket PC. This class cannot be inherited.

Namespace: Microsoft.WindowsCE.Forms
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)

public sealed class InputMethodCollection : IList, ICollection, IEnumerable
public final class InputMethodCollection implements IList, ICollection, 
	IEnumerable
public final class InputMethodCollection implements IList, ICollection, 
	IEnumerable

This collection accesses the methods for text and character entry in the soft input panel (SIP) on a Pocket PC. Common input methods include:

  • Keyboard

    Tap characters on the SIP keyboard or on a hardware keyboard attachment.

  • Letter Recognizer

    Draw letters and numbers in the SIP. When the user pauses, the writing is automatically converted to typed text and displayed at the insertion point.

  • Block Recognizer

    Draw predetermined strokes in the SIP that render as specific characters. This input method is similar to graffiti emulation.

Other input methods can be installed to support languages such as Japanese and Russian. When a new input method is installed on the device, it is included in the input method collection.

Use the InputMethods property to get an InputPanel.InputMethodCollection.

The following code example enumerates InputPanel.InputMethodCollection and lists the available input methods in a list box. When a user selects an input method, the CurrentInputMethod property is set to that input method. The Enabled property for the input panel is set to true so that the keyboard and other input areas are displayed for the user.

using System;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;

namespace InputMethodsTest
{
public class Form1 : System.Windows.Forms.Form
{
 private System.Windows.Forms.MainMenu mainMenu1;
 private System.Windows.Forms.ListBox listBox1;
 private System.Windows.Forms.TextBox textBox1;

 private Microsoft.WindowsCE.Forms.InputPanel ip;

 public Form1()
 {
  InitializeComponent();

  //Display OK Button for closing the application.
  this.MinimizeBox = false;

  MessageBox.Show(ip.InputMethods.Count.ToString());

  // Display the input panel.
  ip.Enabled = true;

  // Get the input methods to populate the list box.
  // Select the first method.
  GetInputMethods();
  listBox1.SelectedIndex = 0;

  // Set the focus on the text box to render input from the input panel.
  textBox1.Focus();

 }
 protected override void Dispose( bool disposing )
 {
  base.Dispose( disposing );
 }
 #region Windows Form Designer generated code

 private void InitializeComponent()
 {
  this.mainMenu1 = new System.Windows.Forms.MainMenu();
  this.ip = new InputPanel();
  this.listBox1 = new ListBox();
  this.textBox1 = new TextBox();
  //
  // listBox1
  //
  this.listBox1.Location = new System.Drawing.Point(8, 40);
  this.listBox1.Size = new System.Drawing.Size(200, 80);
  this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
  //
  // textBox1
  //
  this.textBox1.Location = new System.Drawing.Point(8, 140);
  this.textBox1.Size = new System.Drawing.Size(200, 200);
  //
  // Form1
  //
  this.Controls.Add(this.listBox1);
  this.Controls.Add(this.textBox1);
  this.Menu = this.mainMenu1;
  this.Text = "Input Methods";
 }
 #endregion

 static void Main()
 {
  Application.Run(new Form1());
 }

 private void GetInputMethods()
 {
  this.listBox1.Items.Clear();


 // Get the InputMethods collection and
 // add each method to the list box.
 foreach (InputMethod im in ip.InputMethods)
 {
  this.listBox1.Items.Add(im.Name);
 }
 }

 // This event handler iterates through the
 // InputMethodCollection and sets the input method
 // to the input method selected in the list box.
 // When a member of the collection is the
 // same the selected value in the list box, that
 // method is set to the current input method.
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {

 // Get the selected input method from the list box.
 string strIM;
 strIM = listBox1.SelectedItem.ToString();

 // Iterate through the input method collection.
 // When there is a match with the input method
 // selected in the list box, set the
 // CurrentInputMethod property to the selected method.
 foreach (InputMethod im in ip.InputMethods)
 {
  if (im.Name == strIM)
   // Change the input method.
   ip.CurrentInputMethod = im;
 }

 // Note that the InputMethodCollection
 // can also be enumerated as follows:
 //  InputPanel.InputMethodCollection imc;
 //  imc = ip.InputMethods;
 //  for (int i = 0; i < imc.Count; i++)
 //  {
 //   if (imc[i].Name == strIM)
 //   {
 //    // Change input method.
 //    ip.CurrentInputMethod = imc[i];
 //
 //    break;
 //   }
 //  }

 }
}
}

System.Object
  Microsoft.WindowsCE.Forms.InputPanel.InputMethodCollection

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows CE, Windows Mobile for Pocket PC

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft