Export (0) Print
Expand All
Add Support for Digital Ink to Your Windows Applications
Power to the Pen: The Pen is Mightier with GDI+ and the Tablet PC Real-Time Stylus
Expand Minimize
This topic has not yet been rated - Rate this topic

Developing Tablet PC Software by Using the Windows XP Tablet PC Edition 2005 Recognition Pack

 

Arin Goldberg
Microsoft Corporation

October 2004

Applies to:
   Microsoft Windows XP Tablet PC Edition
   Tablet PC Edition 2005 Recognition Pack

Summary: Develop and test applications for Microsoft Windows XP Tablet PC Edition—specifically, applications that make use of handwriting recognizers—without a Tablet PC, with the functionality included in the Microsoft Windows XP Tablet PC Edition 2005 Recognition Pack. (7 printed pages)

Contents

Introduction
The Three Parts of the Tablet PC Platform
Developing Tablet PC Applications on Operating Systems Other than Windows XP Tablet PC Edition
Other Considerations when Developing Tablet PC Applications on Non-Tablet PC Operating Systems
Make Sure to Satisfy Your Non-Tablet Users

Introduction

Since the release of the first version of the Microsoft Tablet PC Platform in August 2002, one of the largest obstacles to developing applications for the Tablet PC was the absence of handwriting recognizers for non-Tablet PC Operating Systems. Now, with the release of the Microsoft Windows XP Tablet PC Edition 2005 Recognition Pack, this limitation has been removed.

The Three Parts of the Tablet PC Platform

The Tablet PC Platform consists of three basic sets of functionality. These include:

  • Ink Collection

    Collecting input from a digitizing device into Ink data.

  • Ink Data Management

    Managing and examining the Ink data that has been collected by a digitizing device.

  • Ink Recognition

    Recognizing the Ink data into some other format such as Text or Gestures.

For more information about these features, see About Pen Input, Ink, and Recognition in the Tablet PC Platform SDK.

The current Windows XP Tablet PC Edition Development Kit (SDK), v1.7, enables Ink collection and Ink data management on any system that includes Microsoft Windows 2000, Windows XP Professional, or Windows 2003 Server. Up to this point, however, the ability to recognize handwriting and convert it to text has been limited to the Microsoft Windows XP Tablet PC Edition operating system.

Developing Tablet PC Applications on Operating Systems Other than Windows XP Tablet PC Edition

The issue that comes up for developers when developing Tablet PC applications on other operating systems is the lack of available recognizers. Without recognizers, the ink recognition functionality can not be fully developed or tested. This limitation is for both handwriting recognition features as well as gesture recognition. Previously, to fully develop and test for Tablet PC, you had to either install the Windows XP Tablet PC Edition operating system on a traditional computer or have a Tablet PC for development and testing. Now, with the Microsoft Windows XP Tablet PC Edition 2005 Recognition Pack and the Tablet PC SDK 1.7, you can install any or all of the recognizers from the Tablet PC Platform on a qualified development environment.

This recognition pack provides handwriting recognizers for English (US), English (UK), German, French, Spanish, Italian, Korean, Japanese, Chinese (Traditional), and Chinese (Simplified), as well as the Microsoft Gesture Recognizer to enable gesture recognition functionality.

Restrictions of the New Recognition Pack

There are two key restrictions developers should be aware of before using the Recognition Pack:

  • The Windows XP Tablet PC Edition 2005 Recognition Pack is available to developers for development and testing only of their Tablet PC enabled application. This means that it can not be distributed to customers to enable handwriting or gesture recognition on operating systems other than Windows XP Tablet PC Edition.
  • You must install the Tablet PC SDK 1.7 prior to installing the Windows XP Tablet PC Edition 2005 Recognition Pack, on an operating system other than Windows XP Tablet PC Edition.

Other Considerations when Developing Tablet PC Applications on Non-Tablet PC Operating Systems

When developing an application for use on a Tablet PC without an actual Tablet PC consider the following aspects of functionality that are unique to Tablet PC development and customer usage.

Developing Without a Digitizer

A key hardware feature of a Tablet PC is the electromagnetic digitizer that provides user interaction with a stylus. Most desktop computers do not have any sort of electromagnetic digitizer. Without a digitizer it is still possible to collect, manage, and recognize ink, but there are some important considerations when not using a digitizer:

  • A digitizer has much higher resolution (approximately 10X higher) and throughput (approximately 3X higher) than a mouse. A mouse will not provide the quality or quantity of data needed to get the same recognition accuracy as when using an electromagnetic digitizer.
  • Writing on the screen provides a much better user experience then writing off screen. A developer with a Tablet PC will have a much better experience than when developing with either a mouse or external digitizer.

System Tablet PC Input Panel Interactions

Windows XP Tablet PC Edition 2005 contains an operating system component that allows the user to enter text with the stylus and is named Tablet PC Input Panel. Input Panel shows an icon when the stylus is within range and while a text box has focus. Because of this, consider the following when building an application that will run on a Tablet PC:

  1. Input Panel may obstruct some UI when it opens, so it may make sense to modify the UI of the application or write some special code to control where Input Panel appears on the screen. For more information about Input Panel, see Using Tablet PC Input Panel.
  2. You can enhance the recognition accuracy of Input Panel through the use of context awareness. For more information about context awareness, see Improving Tablet PC Recognition Accuracy by Setting Context and the topics that follow it.
  3. Input Panel may not work well with some text input mechanisms, typically ones that are not based on Windows standards.

Context

One feature of the Windows XP Tablet PC Edition 2005 operating system is the ability to apply context awareness to any text entry field within your application. Having context increases the accuracy of recognition results by limiting the scope of the recognition. When building an application on a traditional computer, context should be used when possible, to enhance the Tablet PC user's experience.

Context is only available for development on Windows XP based operating systems (Professional Edition, Home Edition, Media Center Edition, and Tablet PC Edition) that have a minimum of Service Pack 2 installed. Context is not available on Windows 2000 or 2003 based systems at this time.

For more information about programmatically setting context awareness, see Setting Context with the SetInputScope APIs.

Screen Rotation

A Tablet PC may fully utilize the capability of both landscape and portrait screen orientations. This means that a typical XGA system may be in either 1024x768 or 768x1024 resolution. When developing an application that runs on a Tablet PC, consider the information in Designing for Portrait and Landscape Screen Display.

Handedness

Windows XP Tablet PC Edition provides a mechanism to check for user handedness. Some UI elements may require changes to accommodate left-handed or right-handed users. For more information about handedness and Tablet PC applications, see Left-Handedness and Right-Handedness.

Make Sure to Satisfy Your Non-Tablet PC Users

An important note for all developers who install the Windows XP Tablet PC Edition 2005 Recognition Pack is to be aware that when you build an application that utilizes the recognition functionality on your desktop, it will not necessarily work on your end user's non-Tablet PC computer.

Gesture Recognition

Code that tries to use a gesture recognizer can now succeed on a developer's traditional computer but raises an exception on an end user's computer, unless that computer runs Windows XP Tablet PC Edition. The reason is the lack of a gesture recognizer on the end user's computer.

The following code causes exceptions on computers that do not have a valid gesture recognizer.

InkCollector.CollectionMode = CollectionMode.InkAndGesture;
InkCollector.Enabled = True;

The exception is actually raised on the line where the InkCollector is enabled, not on the line where the CollectionMode property is set. This can be confusing because the two actions may lie in entirely different code segments of your application.

In order to avoid this problem, make sure that there is a valid gesture recognizer available before you set the CollectionMode property of an InkCollector, InkOverlay, or InkPicture object. To do this, you can use the following function:

public bool GestureRecognizerExists() 
{
   Recognizers recognizers = new Recognizers();
   // Make sure there are recognizers installed
    // (otherwise return false)
   if (recognizers.Count > 0) 
   {
      // Look through all the recognizers to see if there is 
// a gesture recognizer
      foreach (Recognizer recognizer in recognizers) 
      {
         // If the recognizer's capabilities flag is set to 0,
          //then it's the gesture recognizer
         if (recognizer.Capabilities == 0)
         {
            return true;
         }
      }
      return false;
   }
   else 
   {
      return false;
   }
}

Then you will want to wrap your call to set the collection mode like this:

inkOverlay = new InkOverlay(Handle);
if (GestureRecognizerExists()) 
{
   inkOverlay.CollectionMode = CollectionMode.InkAndGesture;
}
else 
{
   inkOverlay.CollectionMode = CollectionMode.InkOnly;
}

Handwriting Recognition

When adding handwriting recognition code to your application, you make sure that you have a valid handwriting recognizer installed.

The simplest way to make sure there are recognizers installed is to look at the Count property of a new Recognizers object. If the count is zero, then there are no recognizers available and no recognition can occur.

When the count is greater than zero, you must then enumerate the recognizers on the computer to make sure that there is one present for your desired language.

The following code causes exceptions on computers that do not have a valid handwriting recognizer.

RecognizerContext rc = new RecognizerContext();

This code is bad in many ways. First of all, it fails on any computer that is not a Tablet PC. Secondly, it creates a RecognizerContext object that is of the language of the Default UI Language on the computer the code is running on. This may mean that the RecognizerContext object is not the one that you expect.

The proper way to check for a valid recognizer is to look for one that recognizes the language that you want. The following example shows modification of the earlier Gesture recognizer detection code to check for a recognizer of any given language.

public bool DoesRecognizerExist(short languageID) 
{
   Recognizers recognizers = new Recognizers();
// Make sure there are recognizers installed (otherwise return 
// false)
   if (recognizers.Count > 0) 
   {
      // Look through all the recognizers to see if there is a 
// recognizer for the given languageID
      foreach (Recognizer recognizer in recognizers) 
      {
         // If the recognizer's capabilities flag is set to 0, 
// then it's the gesture recognizer
         if (recognizer.Languages[0] == (short)languageID)
         {
            return true;
         }
      }
      return false;
   }
else 
   {
      return false;
   }
}

The code can then be used like this:

if (DoesRecognizerExist(1033)  // 1033 is the decimal value for English
{
   // An English recognizer is on the system
}
else 
{
   // Don't do any English recognition
}

Conclusion

Windows XP Tablet PC Edition 2005 Recognizer Pack empowers a wider base of developers of Tablet PC Applications. Now, you can develop, test, and debug your Tablet PC application without having an actual Tablet PC computer. Ultimately, the truest way to test Tablet PC applications is by using a Tablet PC; however, a lack of that resource need not be a hurdle to creating fine Tablet PC software.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.