Explaining the MultiTouch Client

Note: This documentation is based on my current understanding of the SMART SDK and thus may not be completely accurate.

The MultiTouchClient is perhaps the simplest way (although not the most powerful) to receive and act on mouse events as if they were touch events. Basically, the mouse emulates a finger press, with only the center point returned.

The various tutorial examples illustrate how to use it. This page just explains what is going on.

Essentially, you should create a class that inherits from a canvas and the MultiTouchClient interface

public class MyTouchCanvas : Canvas,MultiTouchClient

Because you declared it as a MultiTouchClient, you can now implement the following three callbacks. Each will return an event that includes the mouse (or touch) ID, and the touch point.

public PointerType OnPointerDown(int ID, Point pt)
    return PointerType.PT_NONE;

public PointerType OnPointerMove(int ID, Point pt, bool bStillInControl)
    return PointerType.PT_NONE;

public void OnPointerUp(int ID, Point pt, bool bStillInControl)

How IDs work.

The above callbacks return an ID, which behaves differently in a mouse emulation vs in a true touch system.

  • Mouse: the ID will always be the same for a particular mouse. Note that the mouse ID is not guaranteed to start at 0! This is really handy, as it means you can use the ID to identify a particular user
  • Touch: the ID will be the same across a continuous OnPointerDown to OnPointerMove to OnPointerUp event (so you can link them). However, the next OnPointerDown may generate a different ID. Thus, unlike in mouse emulation mode, you cannot use the ID to identify a particular user across multiple OnPointerDown events (although you can distinguish one touch from another happening at the same time using this ID).

You only get a restricted set of events.

Remember that this emulates a touch surface. You cannot discover the mouse button state. The mapping of touch events is:

  • OnPointerDown = Left mouse button down
  • OnPointerMove = Left mouse button down and mouse move =
  • OnPointerUp = Left mouse button up

You cannot get

  • Undefined = mouse move with no buttons pressed

Using the Canvas

To use the above canvas, declare it and a multiTouchHandler in your Windows.xaml. See the example. e.g.,

// This is the multi-touch canvas we define in the paintcanvas.cs
public MyTouchCanvas myTouchCanvas;
public MultitouchHandler multiTouchHandler;

public Window1()
   multiTouchHandler = new MultitouchHandler(this, this.myTouchCanvas);   

   //Set the window to the full screen