From iLab Cookbook

Toolkits: 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.

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:

You cannot get

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()
{
   InitializeComponent();
   multiTouchHandler = new MultitouchHandler(this, this.myTouchCanvas);   

   //Set the window to the full screen
   SMARTTableUtilities.SetFullScreen(this);   
}
Retrieved from http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/Toolkits/SMART-ExplaningMultiTouchClient
Page last modified on October 20, 2009, at 12:07 PM