Flexible KeyBoard Control for Mobile Applications

Typing the data into a pocket pc application is important but often very uncomfortable. Using the soft input panel is awkward. Hardware keyboard can help, but it is not always present and because of its generality it doesn't fit the purpose of the application. Creating a useful and good looking keyboard layout is a piece of art. With Resco Custom Keyboard for .NET CF it is simple to create a keyboard layout that looks even like this:

1.jpg

Figure 1.

What is Resco Custom Keyboard for .NET CF ?

Resco Custom Keyboard for .NET CF is a .NET Compact Framework control which serves as a fully functional and customizable keyboard. Customization can be done using Visual Studio's designer. The most important and absolutely unique feature of Custom Keyboard is that developer can design as many keyboard layouts as he needs and then switch among them during run-time. It is also possible to save the created layouts into an XML file and then load the layouts anytime into it during run-time. The developer can change the whole set of keyboard layouts if particular action takes place (such as the user changes the language of the application).

How does it work ?

Custom Keyboard maintains a collection of Layout objects. Each Layout object represents a keyboard layout. A keyboard layout consists of Key Descriptor objects. There are two different approaches when designing a keyboard layout.

Approach I


The developer can create a keyboard layout and add it to the collection. He can assign a unique name for each layout. He can also specify the width and height of the layout. The layout contains a collection of keys. Each key contains Bounds property which defines its position within the layout. Such layout:

2.jpg

Figure 2

can easily be created just using Visual Studio's designer. It automatically generates code which describes the created layout. This is how the layout looks like in Visual Studio's designer:

3.jpg

Figure 3

The color of the pressed key can also be defined. The key is painted that color as long as it is being pressed.

The Key Descriptor object contains many properties which define the way the key is painted. The layout designer can therefore easily achieve the following layout in which particular keys are highlighted:

4.jpg

Figure 4

For example the developer can highlight those keys which are most likely to be pressed while the user is typing.

Custom Keyboard also supports function keys (for example shift key). Creating a function key is as simple as adding a key to the collection and setting its IsFunctionKey property to true.

To create a shift key functionality developer needs two different keyboard layouts. One which will be used when the shift key is pressed and one when it is not. In the Keyboard Key Up event handler, he just needs to activate the other layout by setting Custom Keyboard's Active Layout Index property to appropriate value.

Approach II

The second approach of keyboard's layout design is to use a bitmap coating or a so-called "skin". Custom Key board then displays the skin atop of its client area. This approach provides the developer unlimited possibilities of customization, because he can use any kind of graphics in the skin.

The layout consists of two bitmap images - one that is used when the button is pressed and one when it is not. Let's say that you are creating an application which serves as an electronic survey where the user has to enter the kind of transportation he likes the most. The developer can use the Custom Keyboard and create these 2 skins for it:

   5.jpg

Figure 5

The second one will be used when a button is pressed. Of course, for the Custom Keyboard to work properly, the user has to define the regions of the skin which represent the buttons. For this purpose, Custom Keyboard can be switched into Debug Mode as shown on the following image:

 5i.jpg

Figure 6

Now while a button is being pressed, the region of that button will be painted using the darker skin:

 6.jpg

Figure 7

Conclusion

Resco Custom Keyboard for .NET CF is a very flexible and customizable keyboard control for .NET Compact Framework developers. It can be used in various types of mobile business applications. Field service applications, where the user has to type in specific information such as values obtained by measuring. Even in conditions where users are forced to wear gloves the keyboard can be still easily operated, if the layout was designed carefully enough.

Together with its unique capability which allows the developer to change the layout anytime during run-time, it provides a useful and customizable user interface for purpose of all kinds of mobile business applications.

Availability

Resco Custom Keyboard for .NET CF is part of Resco Mobile Forms Toolkit, which is a suite of Visual Studio controls designed specifically for mobile devices. More information about this popular toolset can be found here.
 


Similar Articles