A Sort of Homecoming

A Sort of Homecoming

The Tablet PC Platform SDK has undergone some notable improvements since its debut in 2001, largely driven by constructive feedback from the developer community. It is now available in its final form, free to download and install from the Microsoft Developer Network (MSDN) on the Web. The Tablet PC Platform SDK is also available on this book s companion CD for easy installation.

The naming of the Tablet PC Platform SDK announces what is unique about it. Platform emphasizes that the Tablet PC platform is designed to enable and significantly enhance pen-driven computing. The entire Tablet PC experience is defined by this completely new platform. The Tablet PC Platform SDK is supported by a host of functionality available only on Microsoft Windows XP Tablet PC Edition. Together, the Tablet PC Platform SDK and Windows XP Tablet PC Edition make powerful pen-driven computing possible.

The Tablet PC Platform SDK has several major conceptual components, listed here. Details regarding some of the components are discussed in the next sections.

  • Managed application programming interfaces (APIs)

    The core of the SDK is composed of a set of APIs exposing pen and ink features that can be leveraged by Microsoft .NET applications.

  • Ink controls

    As a way of supporting simple and rapid integration of ink into applications, several .NET and Microsoft ActiveX controls are provided.

  • Component Object Model (COM) automation APIs

    COM is a core Microsoft technology that has been used widely in the world of Windows programming. These APIs are provided as an alternative to the managed APIs, for use with C/C++ and Microsoft Visual Basic 6.

  • Documentation

    The documentation for the SDK is included with the SDK and is also available on MSDN (http://msdn.microsoft.com).

  • Sample applications

    Several samples are included to demonstrate possible uses of the SDK.

  • Runtime libraries

    To make the development of Tablet PC applications possible on non-Tablet PC editions of Windows, the SDK installs the necessary runtime libraries.

The architecture block diagram in Figure 3-1 shows a high-level view of the Tablet PC Platform SDK architecture. The arrows in the figure represent dependencies between components. At the lowest level of the SDK are the COM automation APIs, which are implemented in C/C++ and directly use Microsoft Win32 calls. The managed APIs are built on top of the COM automation APIs, essentially providing a managed wrapper for that functionality. It s worth noting that the Tablet PC managed API is not merely a subset of the available COM automation features. The managed APIs are fully able to do all the things that the underlying COM automation APIs can, oftentimes in an easier fashion by using features made possible by the .NET architecture.

figure 3-1 the tablet pc platform sdk architecture

Figure 3-1. The Tablet PC Platform SDK architecture

The Ink controls are built with C/C++ and exposed via .NET wrappers for easy access via C#, Visual Basic .NET, and other .NET-capable languages. Unlike the managed APIs, the Ink controls expose only a subset of the available underlying functionality. For instance, the InkEdit control does not give access to the RecognizerContext used when the user writes in it. Instead, the control generates RecognizerContext objects internally, exposing only the Recognizer being used. This makes it impossible for you to provide a RecognizerGuide to influence recognition, and it also makes it difficult to control whether recognition happens in the background. The InkPicture control is less restricted, being mostly a superset of the InkOverlay object. The InkPicture control does not support a few properties and methods, such as AttachMode, OnMouseDown, OnMouseUp, and OnMouseMove, but overall it provides almost all the functionality available in InkOverlay.

Although the Tablet PC Platform SDK is designed to create applications targeting Tablet PCs, it can be installed and used on any PC running Windows XP. This allows for development and testing of Tablet PC software on whatever computer is most convenient for you. However, developing Tablet PC applications on a standard PC has certain limitations. Here are several things to consider when developing with the Tablet PC Platform SDK on a standard PC:

  • Features that rely on the Ink Recognition API will work only on computers running Windows XP Tablet PC Edition. The Ink Recognition API itself will not work, and any other features in the SDK that use the Ink Recognition API (for instance, the InkEdit control s ability to capture and convert ink into text) will be similarly disabled on computers running other versions of Windows.

  • The Ink controls are severely limited when used on any computer not running Windows XP Tablet PC Edition. Most notably, the Ink controls go into what is essentially a render-only mode, where new ink cannot be captured and existing ink cannot be further recognized. Note that this will also severely impact development using the Ink controls on any non-Tablet PC edition of Windows XP. One exception is that InkPicture will capture ink on any computer with the SDK installed. These limitations will be discussed further in Chapter 8.

  • It may be helpful to have a digitizer pad if you are developing on a desktop computer. Not having a pen-based input device makes ink entry and testing somewhat challenging. (Try writing a few words with your mouse in Microsoft Paint to get a feel for what it s like.)

Finding the Right Operating System for the Job

Although the Tablet PC Platform SDK requires only Windows XP, control functionality is actually significantly limited when applications are not run on the Tablet PC edition of Windows XP. The two most significant limitations are that ink recognition is disabled and Ink controls do not capture ink. These limitations mean that most Tablet PC application development efforts will want to have at least one machine running Windows XP Tablet PC Edition for debugging and testing the restricted features.

We recommend that you debug and test your Tablet PC application on a Tablet PC device. One way to do this is to develop and debug entirely on a Tablet PC (with an attached keyboard and mouse, ideally!). Unfortunately, this option appeals to developers about as much as developing and debugging on a laptop would. The other way to debug and test on a Tablet PC device is to use remote debugging so that you can execute your code on a Tablet PC while writing and debugging it from a desktop computer. Regrettably, both methods result in reduced developer efficiency.

Given these restrictions, you may have to incur significant ramp-up time and some inconvenience in order to develop and test the full spectrum of features available in the Tablet PC Platform SDK on a non-Tablet PC computer.

Managed APIs

At the heart of the Tablet PC Platform SDK is a set of managed APIs. A significant part of the Microsoft .NET Framework is the common language runtime (CLR), which controls and supports the execution of .NET-compatible applications written in various languages. The core Tablet PC Platform SDK APIs are managed because they are designed to run in, or be managed by, the .NET Framework s common language runtime. Because the managed APIs target the CLR, you can call them from any .NET language. Currently available .NET languages include Microsoft Visual C#, Visual Basic .NET, managed C++, and Microsoft JScript. In our discussion of the managed APIs, we will be using Visual C# in code samples.

The managed APIs are divided into three subsets, each providing a specific portion of essential Tablet PC pen and ink functionality.

  • The Tablet Input API (Pen API)

    This API is targeted at pen-specific features, such as the various buttons on a pen, and also at collecting digital ink and gestures from the movement of the pen.

  • The Ink Data Management API (Ink API)

    Once ink has been collected using the Tablet Input API, manipulation and storage of the ink is done through the Ink Data Management API. The bulk of ink-related features are exposed through this API.

  • The Ink Recognition API (Recognition API)

    This highly specialized API is used to interpret ink intelligently by grouping and recognizing written ink.

Later in this chapter we will look at the managed APIs in more detail.

Ink Controls

Two Ink controls are included in the Tablet PC Platform SDK as a means to quickly integrate pen and ink functionality into a new or existing application. The controls can be easily dragged onto Windows Forms in languages that support forms-based development, such as C# and Microsoft Visual Basic. Although the Ink controls are presented separately from the managed API and the COM automation APIs, they actually support both. You can use the managed Ink controls from managed code or the ActiveX Ink controls from COM automation code.

  • InkEdit

    This control is an extension of the RichEdit control. It captures and optionally converts ink into text and is ideal in situations where immediate conversion of ink to text is desired.

  • InkPicture

    Meant to capture and display ink over images, this control is an eclectic amalgam of features. Its distinguishing feature is its ability to display an image underneath ink, which is automatically captured and managed by the control.

COM Automation APIs

For developers more familiar with COM, the Tablet PC Platform SDK includes a set of COM automation APIs that are almost direct analogs of the managed APIs. The COM automation APIs allow development of Tablet PC applications in unmanaged code, using languages such as C++ and Visual Basic 6. We have omitted a separate discussion of these APIs because they behave, in almost all cases, exactly like their managed counterparts. If you are more familiar with COM, or would rather develop with the automation APIs, you should find the managed APIs in Chapters 4, 5, and 6 relevant and directly applicable. The differences between the managed APIs and the COM automation APIs can be attributed to the following:

  • Language limitations

    Whereas C# and many other .NET languages support the notion of easily registered event handlers, COM does not. So, for instance, while the managed APIs simply send events to all the attached delegates of an object, the COM automation APIs require that you call SetEventInterest to tell them which events you want to receive.

  • .NET Framework s enhancements

    The .NET Framework used by the managed APIs implements some data structures that are not available to the COM automation APIs. Whereas the managed APIs use the .NET Framework s Rectangle and Matrix objects, the COM automation APIs must provide their own InkRectangle and InkTransform for the same functionality.

  • Unexplained reasons

    There are some differences between the two APIs, and these differences are not easy to understand. Why don t the managed APIs support AddStrokes? Why don t the COM automation APIs support the basic ClipboardCopy? Fortunately, these abstruse differences are relatively rare and should not get in the way of everyday use of these APIs.

More details regarding the differences between the COM automation APIs and the managed APIs are noted in the SDK documentation.

Sample Applications

The Tablet PC Platform SDK comes bundled with quite a few sample applications that demonstrate various features of the SDK. You can access these samples by clicking the Samples and Source Code shortcut in the Tablet PC Platform SDK folder on the Start menu. Many of the samples come with source code for multiple programming languages, which is very convenient if you are particularly adept in a particular language. The included samples fall into three major categories:

  • Ink

    These samples show how to do common things with ink, such as collecting, erasing, zooming, and saving. You may be interested in the Ink Zoom sample, which illustrates the relationship between three coordinate spaces: tablet space, ink space, and view space.

  • Recognition

    The Ink Recognition and Advanced Recognition samples are particularly good starting points that show how the Ink Recognition API is used.

  • Controls

    There are two controls samples, Auto Claims and Scanned Paper Form, which demonstrate the InkPicture and InkEdit controls, respectively.

The SDK documentation briefly describes the samples included, but you should take a look at the source code and try some of the samples to get a more complete picture of what they demonstrate.

A Word or Two About the Speech API

Speech recognition will play an important role in the Tablet PC experience in many applications. By nature of its portability and keyboard-free operation, the Tablet PC lends itself to many scenarios in which speech recognition is important. This is why the Tablet PC design guidelines included in the SDK documentation feature a good amount of discussion related to the role of speech on Tablet PCs. The Windows XP Tablet PC Edition has a very good built-in speech recognition engine, making it easy to integrate speech into your Tablet PC applications.

For a number of years now Microsoft has been shipping the Microsoft Speech API (SAPI) SDK. The SAPI SDK is currently in its fifth major revision, and it contains some of the best speech-recognition technology available on the market. Although the Speech API and speech recognition in general can play an important part in some Tablet PC applications, we will not be addressing SAPI in this book. The issues and considerations that go into developing a successful speech-enabled application are intricate, deserving the more thorough and comprehensive treatment available in speech recognition books as well as the SAPI SDK documentation. We encourage you to download and try the SAPI SDK from Microsoft s Web site, at http://www.microsoft.com/speech/. Speech recognition is an exciting world all its own!



Building Tablet PC Applications
Building Tablet PC Applications (Pro-Developer)
ISBN: 0735617236
EAN: 2147483647
Year: 2001
Pages: 73

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