Tablet 101 Column 1: Getting Started

Frank Gocinski

Microsoft Corporation

May 2004

Applies to:
   Microsoft® Windows® XP Tablet PC Edition
   Application Integration
   Ink-Enabled Applications

Summary: Describes the Windows XP Tablet PC Platform and how developers can migrate existing applications to the platform or create new applications for the platform. In addition, this article lists further resources for developers wishing to employ the Tablet PC Platform API. Code examples are written in C#. Readers need not be previously familiar with the Tablet PC Platform API but need be familiar with managed code to understand the examples. (9 printed pages)

Contents

Introduction
Introduction to Tablet PC
Show Me Some Code!
Three Levels of Application Integration
Facing the Future Together

Introduction

Welcome to our first Tablet 101 column! This monthly column is dedicated to helping developers get acquainted with the Tablet PC Platform. I'll spend the bulk of my time walking you through the stages of integration and explaining how to use the Microsoft® Tablet PC Platform API to accomplish your goals. There are many great articles, papers, and Web sites out there to help convince you that it's now time to start thinking about Tablet PC. Industry momentum is strong. I don't intend to cover that aspect here. My assumption is that you're reading this column because you want to learn how to go about developing an application for computers running Microsoft Windows® XP Tablet PC Edition.

So, where do we start? Let's start with the two most basic questions: What exactly does it mean to have a Tablet PC application? How much investment do you need to make in order to make your application run on the Tablet PC? These are natural starting points for me as the manager of ISV Evangelism for the Tablet PC team here at Microsoft. My goal is to simplify the development lifecycle that's necessary for the Tablet PC platform to be successful. Think of us as partners. Microsoft builds the platform, you build the applications, and customers buy the applications that run on that platform. This works well for all of us.

Introduction to Tablet PC

The Tablet PC is the next-generation PC; it's the evolution of the notebook computer. I'll define a Tablet PC as a computer that runs Microsoft® Windows® XP Tablet PC Edition operating system. By running Windows XP Tablet PC Edition, a Tablet PC incorporates the convenient and intuitive aspects of natural input, including input by using pen and speech. A Tablet PC provides all the performance and features of today's notebook computer in an ultra-light form factor, including the ability to run full versions of standard Windows applications. By providing advanced handwriting recognition and a natural interface for entering data by using a pen—in addition to a keyboard—the Tablet PC opens exciting new opportunities for mobile computing.

The beauty of all this is that the Tablet PC offers real return on investment for its owner. Being more efficient during the day adds up, especially when efficiency is measured in many ways. Perhaps increased efficiency comes from taking digital notes by using the pen; perhaps from being able to use your standard applications in new social settings. Maybe annotating documents by using the digital pen increases editorial flow; maybe ink in an e-mail deepens a relationship with a customer. Once an end user realizes the out-of-the-box efficiencies of the Tablet PC platform, the decision to buy becomes clear.

Microsoft has done a great job of making the transition from traditional computing to Tablet PC computing seamless. In the upcoming release of Windows XP Tablet PC Edition 2005, the new and improved Tablet PC Input Panel makes it even easier to enter handwriting and converting it to text. The Ink-to-Text scenario is extremely important, as most applications today don't have a defined role for Ink. We've worked hard to provide you and users with a platform in which the handwriting-to-text experience is effortless, minimizing any barrier to adoption.

So, if most Windows applications already run on a Tablet PC and Tablet PC Input Panel changes ink to text seamlessly, what's left? Well, lots. As we'll see over the upcoming months there are many opportunities for you to use the Tablet PC platform to both energize your applications and appeal to new customers and opportunities. The transformation from handwriting to text is certainly important, but it's only one part of the equation. As developers, we need to build applications that support handwriting and drawing in new and innovative ways. The innovations that you bring to this platform will help change the computing world. This is an amazing opportunity to affect mainstream computing. Read on; let's do this together!

What's in that Screen?

The main physical difference between a standard notebook and a Tablet PC is the digitizer incorporated in the display screen. The digitizer enables your application to recognize the movement of the pen. Conceptually, the digitizer-pen relationship is similar to that of a screen and a mouse. However, the digitizer runs at a much higher resolution than a screen. Furthermore, the digitizer samples or collects information about the pen much faster than a screen shows information about a mouse—about an order of magnitude faster. The sampling rate is important for handwriting recognition, as the recognizers need as much information as possible to help decode the stroke information. What's the technical information behind a stroke? Don't worry, we'll get to that!

That's it. Other than the pen and the digitizer, a Tablet PC is the same as your notebook computer. The operating system is primarily the same. Windows XP Tablet PC Edition is Windows XP Professional Edition with some additional functionality to enable users to collect, render, and recognize ink. You'll start to see us and our OEM partners market this point more and more: Tablet PC functionality should be a feature of every mobile computer.

Show Me Some Code!

OK, enough with the basics. How do you collect ink on the Tablet PC? I thought you'd never ask. I know some of you are also asking whether you need a Tablet PC to build Tablet enabled applications. While I think you should have a Tablet PC to test on before you ship your application, the answer is no, you don't need a Tablet PC to develop applications that target this platform. For answers to other questions like this, take a look at the excellent FAQ that Arin, our ISV Architect, wrote. It's available on the MSDN Library, and one of the issues the FAQ addresses is how you can build applications for the Tablet PC on your desktop computer.

Let's start with a simple Windows forms application written in C# (and I mean simple; this application is exactly what you get when by creating a new Windows application in Microsoft® Visual Studio® .NET). We'll add inking functionality with a single reference and a few lines of code.

In Visual Studio, open a new Microsoft® Visual C#® Windows forms project. The first thing you need to do to build an ink-enabled application is to add a reference to the Microsoft Tablet PC API DLL.

To add a reference to the Windows XP Tablet PC Edition Development Kit in Visual Studio .NET

  1. Open your Visual Studio .NET project.
  2. On the Project menu, click Add Reference.
  3. On the .NET tab in the Add Reference dialog box, on the components list, select the latest installed version of Microsoft Tablet PC API.
  4. Click Select, and then click OK.

The previous illustration shows adding a reference to version 1.7 of the DLL, but the following code works with all versions of the Tablet PC Platform SDK.

Next, add a using statement at the beginning of your code to access the Microsoft.Ink namespace. Doing so also activates Intellisense® for the Tablet PC API within Visual Studio.

using Microsoft.Ink;      // add reference to the Ink Namespace 

Finally, declare a variable for an InkOverlay object. In the constructor, be sure to add code to create and enable the InkOverlay object.

Note   You must pass the window handle to which the form is bound into the constructor in order to collect ink. Furthermore, if you do not enable the InkOverlay object, you cannot collect ink.
public class Form1 : System.Windows.Forms.Form
   {
      private System.ComponentModel.Container components = null;
      private InkOverlay theInkOverlay;
      
      public Form1()
      {
         //
         // Required for Windows Form Designer support
         //
         InitializeComponent();
         //
         // TODO: Add any constructor code after InitializeComponent call
         //
         theInkOverlay = new InkOverlay(this.Handle);
         theInkOverlay.Enabled = true;
      }

That's all the code you need to collect ink on a standard Windows forms application. You've created your first ink-enabled application by adding less than five lines of code. Isn't this platform cool? Now, save, build, and run the project in order to draw your first strokes. Go ahead; use your tablet pen to draw ink anywhere in the form's window. You can also use a mouse to draw ink if you are developing on approved hardware other than a Tablet PC.

Not enough? You want to get fancy? Not a problem. The InkOverlay class exposes a DefaultDrawingAttributes property, through which you can change various attributes for all ink strokes, such as color and width. Let's change the color to red and make the stroke width 100 units. 100 units may seem wide, but these units are HIMETRIC, so one logical unit is equal to 0.01 mm. Just add two more lines of code, highlighted in the following example.

         //
         // TODO: Add any constructor code after InitializeComponent call
         //
         theInkOverlay = new InkOverlay(this.Handle);
         theInkOverlay.Enabled = true;
         theInkOverlay.DefaultDrawingAttributes.Color = Color.Red;
         theInkOverlay.DefaultDrawingAttributes.Width = 100;

Save, compile, and run the application. Go ahead and write something to see the effect of the changes you made.

Impressive isn't it? There's a lot more to play with, so keep experimenting with the API. You can attach an InkOverlay object to a specific control; you can implement one of the two existing controls, InkEdit or InkPicture; or you can design a recognizer for specific vertical needs. The choice is yours.

My next column will dig a little deeper into the world of ink-enabled applications. Now, however, it's time to get back to the first question posed: What exactly does it mean to have a Tablet PC application?

Three Levels of Application Integration

As you may know, our industry has tried to use the natural input of pen and speech in computing for quite some time. In the past fifteen years, there have been a number of notable successes, as well as a few spectacular failures. These were all impressive for their time. The difference today is that the Tablet PC is the ultimate fusion of both software and hardware. Processors now have the ability to handle the large amount of data needed for viable pen computing, and the Tablet PC platform provides an intelligent software experience. Our OEM list is formidable. Our hardware partners are investing as heavily in this platform as are Microsoft and our ISV community. We now have the computing power and the software intelligence to finally bring the pen into the computing mainstream. As I see it there are three levels of integration for which applications running on a Tablet PC can do this. These are ISV-supported, Pen-centric, and Pen-perfect applications.

ISV-Supported Applications

The first level of application integration is what I'll call ISV-supported. At the ISV-supported level the developer verifies that his or her existing applications run on the Tablet PC. The application should:

  • Install without a keyboard.
  • Run in both portrait and landscape display mode.
  • Behave normally, and, with the help of Input Panel, collect handwriting and transform it to text.

With this verification you can assure end users that their experience running your application on the Tablet PC will be a positive one. By the way, if you do this let us know. Send and e-mail to TabISV@Microsot.com and get your application listed in our online catalog.

Pen-Centric Applications

The next level is occupied by what are traditionally called pen-centric applications. In a pen-centric application, you, as the developer:

  • Have incorporated ink into all or parts of your application.
  • Use the Tablet PC API to deliver support for ink and use of the pen.

This may be as simple as grouping like controls to make it easier for the user or providing some level of ink interoperability. Take a look at the latest versions of Microsoft InfoPath™ or MSN® Messenger. These applications have defined roles for ink.

Pen-centric applications also support a feature with new possibilities in Windows XP Tablet PC Edition 2005, context awareness. Context awareness is a way to constrain the recognizers to a fixed set of possible results, which increases the overall recognition accuracy. Think about an application that has a field for a state name or a postal code. With context awareness supported, your application indicates to Input Panel what type of content you expect in the field, whether a predefined list of state names and abbreviations or strings of numbers and letters. As a result, the recognizers achieve better accuracy than if they are trying to match results against a dictionary of 100,000 words.

There are a couple of ways to implement context awareness in your applications. We'll delve deeper into context in upcoming articles. If you have access to the Tablet PC Platform SDK, you can learn more about context awareness. New to version 1.7 of the SDK—currently in Beta—is the Context Tagging tool, which builds an XML manifest file containing the mapping between edit fields and expected data types. The Context Tagging tool enables you to ship support for context without editing your binaries. However, using the Context Tagging tool is an intermediate remedy. While the tool works wonderfully, providing context awareness programmatically—by using the Win32 SetInputScope API, factoids, or word lists—increases application performance and platform integration. Again, we'll examine context further in upcoming articles.

Pen-Perfect Applications

The ultimate level of application integration exists in what are traditionally called the pen-perfect application. Pen-perfect applications:

  • Are optimized to run on the Tablet PC.
  • Fully support ink interoperability.
  • Use gestures as part of their user interaction model.
  • Adhere to our collection of Tablet PC Design Guidelines.

Pen-perfect applications just feel right when used with a pen. Quite frankly, pen-perfect applications become the applications that drive sales of the platform rather than applications that are added to a purchased platform as a second thought. Windows Journal and Microsoft® OneNote™ come to mind as examples of pen-perfect applications, but there is also a great collection of ISV applications that qualify as pen-perfect. Check out http://www.tabletpcpost.com to see some more.

Facing the Future Together

In summary, the Tablet PC will make its mark on mainstream computing because it is the right platform at the right time. This is evident by the amount of industry momentum. Because Windows XP Tablet PC Edition is built on Windows XP, we're making it easy for you and your users to transition to the Tablet PC. As application developers you have a manageable integration scale to work on: verify your applications, think about the role of ink, and then optimize your applications to support the mobile worker and consumer on Tablet PC. The opportunities are endless.

There's a lot more information for you on our new MSDN development center. Read our featured column about ISV programs; sign up for our newsgroups, where all your questions will be answered; request the Beta version of our new operating system at tabbeta@microsoft.com; get your ISV-supported application into our new catalog; join our Tablet PC Partner program by sending e-mail to TabISV@micorosoft.com; and, as we like to say around the product team, Think In Ink! Oh, yes, and don't forget to come back and read future installments of Tablet 101 for ideas, tips, and tricks about integrating ink into your application and your company's future.

Show: