This project is read-only.

walkthrough of new gesture creation

Topics: Gesture Definition
Apr 14, 2011 at 7:27 AM

Hi Shahed

Sorry it has been some time since you've heard from me.  I don't know if you recall but I was having problems with our hardware.  It turns out the hardware we have is a G2 overlay, which only supports a few touches.  It seems that it can recognise 1 or 2 touches, but more than that generates a single "multi down" event located at the centroid of the touch pattern.  We are in the process of upgrading to the PQ Labs G3plus which fully supports 32 independent touches. 

I have been trying to create a new gesture but I am not sure exactly how the engine reads the files.  I have tried to create a new Lasso gesture using your instructions but I can't seem to get it to work.  

Could you walk me through how to create a brand-new, simple gesture, including where to create the files?  Something simple, like tracing a circle with one finger on an object.  It would be a huge help!



Apr 19, 2011 at 4:00 AM

Hi Ivan,

Sorry for my late reply. I was a bit busy at work. Its great to know that the issue with your device is now resolved.

Currently, the best way to write a custom gesture definition is using Visual Studio 2010. (You will need to install the template from the download section)

Then you can use the "Gesture Definition Template". Here is a youtube video: You skip first 2 min, at 2:05 min it shows how to create a new gesture definition.

I guess you have already read this wiki page. There are 3 sections in any gesture definition. The validation rules are defined under the validate block. You can use the existing primitive conditions (you can also create new primitive conditions) to define the rules. For example: lets say you want to detect a circle of 200 to 300 px size on an object, then the gesture definition would look like this:

name: myCircle

Touch state: TouchUp and
Touch path bounding box: 200x200..300x300 and
Touch shape: Circle 


[Note: I didn't test the above definition, please let me know if that doesn't work]

Jul 5, 2011 at 1:12 PM

Hi Shahed

Our new hardware is up and running :)

Thanks for the video tutorial it helps a lot.  I'm able to add and create my gestures.  I'm just getting a strange behaviour when the gesture is detected - an "open" dialog box pops up in VS titled "Find Source" and looks for a variety of source files, including:






I have looked through your source code releases but they don't seem to include these files.  Do you have any suggestions?  



Jul 6, 2011 at 2:34 AM
Edited Jul 6, 2011 at 2:34 AM

Hi Ivan,

Its great to know that your system is working fine.

Its an interesting issue but not sure whats causing it? Could you please send me a screen shot when you face the problem. 


The source code is there but in different folders. For example:



Jul 6, 2011 at 10:37 AM

The debugger was just trying to open the source to show me the exception...

What I have done is created a new gesture called Box.g and copied your code for Box verbatim.

When the gesture is made, it asks for the source for TouchShapeValidator.  There is a NullReferenceException - the variable tps is null in the Validate method. 

I have also tried this with your Left gesture, it gave an ArgumentNullException in ReturnTypeInfoCollection.Calculate()   retInfo.CalculatorType is null.

I can send a screenshot if it will make it clearer?  To where must I send it?