Explaining the MultiTouch Client

Toolkits.SMART-ExplaningMultiTouchClient History

Show minor edits - Show changes to output

Changed lines 41-46 from:
!!!What you don't get
Remember that this emulates a touch surface. You cannot discover the button state. The mapping of touch events is:
* Left button down = OnPointerDown
* Left button down and
mouse move = OnPointerMove
* Left button up = OnPointerUp
to:
!!!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
Added line 35:
Added lines 41-46:
!!!What you don't get
Remember that this emulates a touch surface. You cannot discover the button state. The mapping of touch events is:
* Left button down = OnPointerDown
* Left button down and mouse move = OnPointerMove
* Left button up = OnPointerUp
Changed lines 10-13 from:
public class MyTouchCanvas : Canvas,MultiTouchClient
{
}
to:
(:source lang=csharp tabwidth=2 :) [=
public class MyTouchCanvas : Canvas,MultiTouchClient
{
}
=]
Changed lines 20-33 from:
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)
{
}
to:
(:source lang=csharp tabwidth=2 :) [=
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)
{
}
=]
Changed lines 43-54 from:
// 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);
}
to:
(:source lang=csharp tabwidth=2 :) [=
//
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);
}
=]
October 19, 2009, at 09:31 AM by 136.159.7.119 -
Added lines 3-4:
''Note:'' This documentation is based on my current understanding of the SMART SDK and thus may not be completely accurate.
Changed line 38 from:
TO use the above canvas, declare it and a multiTouchHandler in your Windows.xaml. See the example. e.g.,
to:
To use the above canvas, declare it and a multiTouchHandler in your Windows.xaml. See the example. e.g.,
October 19, 2009, at 09:30 AM by 136.159.7.119 -
Changed line 8 from:
public class MyPaintCanvas : Canvas,MultiTouchClient
to:
public class MyTouchCanvas : Canvas,MultiTouchClient
Added lines 35-48:

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);
}
October 19, 2009, at 09:27 AM by 136.159.7.119 -
Added lines 1-34:
(:title Explaining the MultiTouch Client :)

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 MyPaintCanvas : 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).

!!Using the Canvas