Intro to Touch on Ultrabook: Getting started

Touch screens were once an exotic way to interact with special devices, but they’re becoming an everyday part of devices and computers. In addition to phones and tablets, more laptops and convertible computers now include touch screens. As we approach the release of Windows 8, we’ll see new Ultrabook designs that include touch screens. We'll also see more convertible designs, which convert from clamshell-style laptops to tablets. With all of this touch capability, I’ve been wondering what Touch means to an app developer.

In this blog series, I’ll start answering some of those questions for Windows 8. In this post we will look at the available interfaces for Windows 7 and Windows 8, and go over which you might want to use. I’ll introduce you to the Windows 7 interfaces, and set the stage for some detailed code samples in upcoming posts.

You may not think that Touch can be valuable on clamshell-style laptops. Take a look at some research that shows how people like Touch in laptop computers.

Note: This discussion of the Windows APIs assumes you’re writing code in C++.

What is Touch?
How does this Touch stuff work, anyway? Several different technologies are involved, but on everyday devices and computers, you’ll mostly use capacitive touchscreens. These (usually glass) screens are printed with a nearly-transparent conductor like Indium Tin Oxide (ITO). Two arrays of this conductor (rows and columns) are printed, either on opposite sides of the screen or on separate layers of screen material. When a conductor, like your finger, approaches the surface, it changes the capacitance at that location. These conductors are sampled to show which screen location(s) are being touched.

The raw data from the touchscreen is cleaned up, usually in the device’s firmware. First, any noise needs to be eliminated, to reject any signals that aren’t strong enough. Then, the intersection of the grids is captured to show the finger locations. If there are multiple touches on the screen at the same time, temporal tracking is used to decide which coordinates were actually selected.

This cleaned-up data can be seen directly by your app, or composed over time into gestures (like panning with a finger-swipe, zooming with a pinch, rotating with two fingers, and many more). The touch and gesture data are made available to you via a Windows API.

Designing for Touch
Understanding the mechanics of your interface and design principles for touch is more than I can cover here. See the excellent paper on Touch by Microsoft. In their paper, Microsoft teaches you how to increase your customers’ confidence and efficiency via sizing and placing your controls and direct manipulation. It also shows which gestures your customers will use with your app. You should decide which gestures are meaningful to your app now.

Once you’ve considered how to adapt your UI to Touch (or create your UI), continue here.

Which programming interface?
Windows 8 supports a new set of touch and gesture messages. The richest touch and gesture messages are available to your code from WinRT. You can only use the WinRT interface when your code is running under the new Windows 8 user interface. If you’re running Windows 8’s desktop interface, the Windows 7 touch and gesture messages are still available and operational. Which will you use? Well, that depends.

If you’re committed to the Windows 8 user interface and want the richest Touch support for your app, then you should definitely program with the WinRT interface.

If you want to support Windows 7 touch systems, you must use the Windows 7 interface. You’ll also get backward compatibility support for this interface on Windows 8 desktop. This is a good solution if you want to have support for the largest customer base for your app. We’ll start exploring touch in this series with the Windows 7 interface, since it may be most interesting to developers right now.

Whichever interface you use, you’ll find a wealth of info on getting started on the Microsoft website. I’ll offer a sampler here, too.

Next time
In the next post, I'll review the Windows 7 interface in more detail.

In upcoming blog posts, I’ll review the Windows 7 interface in more detail, and show some code samples using that interface. Then, I’ll shift attention to WinRT, to show how similar code can be written for the Windows 8 user interface. Remember that Windows 8 extends the touch messages that we’ve been looking at here, with a more unified input model.

References
Microsoft Windows 7 touch guide
Responding to user interaction
Ultrabook tech page
Troubleshooting touch applications

Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.