Iris Classon
Iris Classon - In Love with Code

What you must know about pen and touch in Windows Store Apps

Did you know there are different types of pens, two main ones? One that is considered as touch and one as pen?

Let’s take a step back and get some basics down.

Responding to user interaction in Windows Store Apps is very easy. Reacting, filtering and responding to user interaction. Since Windows Store Apps are touch first the mouse events we are used to have been replaced by lower level gestures that more or less correspond to the traditional mouse input events. These are called the Pointer events and they work just as well with mouse, touch or pen/stylus. But how do you know what was used?

What you must know about pen and touch in Windows Store Apps

Identifying pointer devices

Here is an example of how you can retrieve information about the pointer device:

Getting the type:

[sourcecode language=“csharp”]
private void RecAOnPointerPressed(object sender, PointerRoutedEventArgs e)
{
feedback.Text = e.Pointer.PointerDeviceType.ToString();
}
[/sourcecode]

Comparing:

[sourcecode language=“csharp”]
private void RecBOnPointerPressed(object sender, PointerRoutedEventArgs e)
{
if (e.Pointer.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Pen) return;
feedback.Text = “You just clicked with mouse or touch”;
}
[/sourcecode]

What you must know about pen

While a Mouse device is just that, and Touch is also fairly straight forward, there are two types of pens! One that registers as touch and one that registers as a pen. To take full advantage of the pen capabilities the user needs to have a device that has an attached digitizer that accepts pen input. Therefore, to no surprise, there are different types of pens – in particular two main types:

  1. Active Stylus input for resistive digitizers

  2. Passive stylus input for capacitive digitizers

The passive stylus types are basically just elongating you finger, when they touch the surface that is how they are registered, as a finger.
The ink platform in Windows 8, if you want to create an app that takes advantage of the ink functionality don’t forget to think about these things.

Have a read about this here: Responding to pen and stylus interactions (Windows)

Comments

Leave a comment below, or by email.


Last modified on 2013-01-12

comments powered by Disqus