CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

Adding an external tablet to a tablet PC and peaking around with the tablet API

In a recent post I introduced my Wacom USB drawing tablet. When you attach that to a tablet PC (I use an Acer Travelmate C110) the functionality is far better than attached to a "normal" PC. The click-and-hold action, illustrated in the previous post, now works for the PC's pen and for the tablet's pen.

For a more detailed exploration of this dual-tablet machine I'm going to use the samples which come with the "Building tablet applications book". The samples are organized in solutions, one solution for every chapter. Chapter 4 deals with input. That is the bare input, just the presence of a pen and motions it does make. No ink yet, that's another layer. The DeviceWalker sample enumerates all tablet devices found and their capabilities. The Tablets class in the API is the starting point, it is a collection of Tablet objects present. Every tablet has a number of properties, like the size of the input panel and it's hardware capabilities. The Devicewalker sums up the tablets found and displays their capabilities one at a time. You will see that the external Wacom is recognized and a full player.

The only property which is different from the built in device is integrated. Makes sense, the tablet is external.

The first opportunity to intercept the raw tablet input is by subscribing to events fired by the drivers of the hardware. There are quite a number of different events, from a tablet device being attached or removed to the pen hovering over the scribbling surface. In the InputWatcher sample you select subscriptions; the app will list the events coming in with some of the data. As in every .NET event the event data are in the second eventargs parameter. There are several tablet eventargs classes in the API, each of them with appropriate properties. The property almost all share is the CursorId. On a tablet every tip of a pen is a cursor and every cursor has an ID. The mouse has one (you can scribble with a mouse). The pen of a typical tablet usually has an eraser tip on the back, so the pen has two. The value in the event arguments will tell you which pen tip was used. The external pen of the Wacom has it's own ID.

Here I first clicked the drawing surface with the mouse, then with the tablet's pen, with the tablets eraser and with the Wacom pen. The app reports the corresponding Id's.

As a next experiment I tried changing the pens. Moving the Wacom pen over the display does move the mouse. But moving the PC's pen over the Wacom tablet did not result in any movement. Another difference is the thickness of the strokes drawn. A tablet pen is pressure sensitive, the harder you press, the thicker the line. Trying to draw with the Wacom pen on the PC's screen results in very thin lines when the sensitivity is set to "firm" and to no lines at all when set to “soft” tip. The inputwatcher does display the same events with both pens, the difference will be in the values of the data.

When an event is fired a packet containing the input data is received. In this packet are things like the coordinates of the pen and the pen-pressure. Another sample application, the PacketPropertyWatcher inspects the packages arriving from the default tablet. That is the integrated digitizer, when you draw on the external this app does nothing. The sample displays the X and Y coordinates of the pen in tablet metrics. Which is far more precise than pixels. As a third value you can select the pressure applied to the pen.

When drawing with the tablet pen this lists anything between 0 and 255, when using the Wacom pen it does not get past 16. It looks like the difference between the two pens is the strength of the pressure signal. As another alternative I tried the pens of various junior tablets, none of them resulted in any packet at all. So I am still waiting for the universal pen.

I hope this gave you a glimpse of the architecture of the tablet input system. If you want to know more, do read the book, and come to Windows Anywhere.

Peter


Published Jan 28 2005, 12:06 PM by pvanooijen
Filed under:

Comments

Peter's Gekko said:

Tablet PC pen capabilities and the tablet API
# January 31, 2005 1:10 AM

TrackBack said:

# February 18, 2005 12:42 PM

TrackBack said:

# February 18, 2005 12:47 PM

Peter's Gekko said:

Recently I had been playing with a small external Wacom Volito tablet. I wasn't too pleased with it,...
# January 30, 2006 8:25 AM

nfk said:

If you set your TabletPC orientation to Portrait, does the external tablet work correctly so you can write on it in portrait mode?

# February 15, 2007 5:12 AM

pvanooijen said:

When you change the orientation mode of your Tablet PC you are changing the orientation mode of the screen tablet. The external tablet is another separate device.

# February 16, 2007 5:04 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

This Blog

Syndication

News