26.4 Manipulating the Soft Input Panel

 <  Day Day Up  >  

You want to programmatically control the Soft Input Panel (SIP) .


Technique

The .NET Compact Framework contains a Windows Form control specifically designed for mobile devices. The control is called InputPanel , and you use it to control when the SIP is shown to the user . The SIP is a special operating system control used to enter data with a small keyboard, by writing letters and numbers with the stylus in designated boxes, or by writing on the screen at any location using the Transcriber technology in the Pocket PC operating system.

After creating the project, drag and drop the InputPanel control onto the form. Because it is a nonvisual control, it shows up in the designer tray at the bottom of the designer window. Whenever you want to enable the SIP, set the Enabled property of the InputPanel to true . You want to do so whenever any control that accepts text input receives focus. For instance, you want to create an event handler for the GotFocus event for a TextBox control and set the Enabled property of the InputPanel to true . Likewise, add an event handler for the LostFocus event and set the Enabled property to false , as shown in the following code:

 
 private void textBox1_GotFocus(object sender, System.EventArgs e) {     inputPanel1.Enabled = true; } private void textBox1_LostFocus(object sender, System.EventArgs e) {     inputPanel1.Enabled = false; } 

Comments

As mentioned earlier, the default SIP for the current version of the Pocket PC operating system allows you enter text using one of three methods. Two of these methods , the keyboard and letter recognizer, display a small window at the bottom of the screen. This window means that the viewable area for your user interface becomes even smaller. While the InputPanel control is enabled, you can retrieve the viewable area by accessing the VisibleDesktop property of the InputPanel . One thing to watch for is controls that are covered once the input panel appears. In other words, if you have a TextBox control at the bottom of your form, users will have a hard time entering text if they cannot see what they are entering.

 <  Day Day Up  >  


Microsoft Visual C# .Net 2003
Microsoft Visual C *. NET 2003 development skills Daquan
ISBN: 7508427505
EAN: 2147483647
Year: 2003
Pages: 440

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net