HTP Events

Events - Concepts

The HTP API Toolkit offers a wide variety of events that users can take advantage of. However, the most important aspect to consider is the adaptation of the surface events Contact Down, Changed and Up. For users unfamiliar with such events, they work similar to the mouse events supported in WPF. We also provide event arguments in which more information can be accessed regarding the HTP.

The event arguments include:

  • Current HTP - returns the HTP triggering the event.
  • Center Point - returns the center point of the HTP.
  • End Point - Returns the end point of the HTP if an offset has been set.
  • Friction - Returns the current friction value of the HTP.
  • Height - Returns the current height value of the HTP.
  • ID - Returns the ID that corresponds to the HTP (the marker tag).
  • Orientation - Returns the orientation of the HTP.
  • Pressure - Returns the pressure value of the HTP.

Programming with Events

Event programming is simple and it's done independently for each HTP (although multiple HTPs can be associated to a particular event).

Please note that the HTP contact events covered here are only available when working in the medium and high levels.


In this example we create a basic application in which a behavior's parameter changes depending on the location of an HTP.

  1. HTPManager manager = HTPManager.Instance;
  2. IntensityBehavior intensity;
  4. public HTPWindow()
  5. {
  6.   InitializeComponent();
  8.   // Add handlers for Application activation events
  9.   AddActivationHandlers();
  10.   // Default Window Registration
  11.   this.manager.RegisterWindow(this, this.HTPCanvas);
  13.   // HTP 0xB8 will test the medium level
  14.   HTP h1 = this.manager.GetHTP(0xB8);
  15.   intensity = new IntensityBehavior(0.5);
  16.   h1.AddHeightBehavior(intensity);
  17.   h1.WidgetWeight = 0.0;
  18.   h1.HTPDown += new HTPEventHandler(h1_HTPChanged);
  19.   h1.HTPChanged += new HTPEventHandler(h1_HTPChanged);
  21. }
  23. void h1_HTPChanged(object sender, HTPEventArgs e)
  24. {
  25.   this.intensity.Intensity = (e.CenterPoint.X / 1024.0);
  26. }