Main Site Documentation

Passing touch into glide


#1

I have a capacitive touch that is working with Skewwoks CLIX and I can pass touch to it.

I am now trying to port the driver to use with my Glide based application and I am having an issue passing in the touch.

The issue is that the following line leaves “touches” as null when it runs.


            touches = new Microsoft.SPOT.Touch.TouchInput[1];

I am calling GlideTouch.Initialize() in the startup code.


#2

Dave

I am also using a Newhaven Display with CLIX. Can you post some code that shows how to get touch working with CLIX?


#3

Hi Charlie,

If you are using the capacitive touch version then Simon has created a very nice driver for this.

Check it out

https://www.ghielectronics.com/community/codeshare/entry/794

It works fine with Clix. I used the following in the event handlers that Simon’s code calls. I’ll take out the debug later when the code is finished.


        static void display_TouchDown(DisplayNhd5 sender, TouchEventArgs e)
        {
            point loc;

            Debug.Print("Finger " + e.FingerNumber + " down!");
            Debug.Print("Where " + e.X + "," + e.Y);

            loc.X = e.X;
            loc.Y = e.Y;

            Core.RaiseTouchEvent(TouchType.TouchDown, loc);
        }

        static void display_TouchUp(DisplayNhd5 sender, TouchEventArgs e)
        {
            point loc;

            Debug.Print("Finger " + e.FingerNumber + " up!");

            loc.X = e.X;
            loc.Y = e.Y;

            Core.RaiseTouchEvent(TouchType.TouchUp, loc);
        }


#4

Dave

I had the same problem with passing touch into glide. I kept getting null reference exception errors when I used



A work around is to use


```cs]Microsoft.SPOT.Touch.TouchInput[] touches = new Microsoft.SPOT.Touch.TouchInput[] {new Microsoft.SPOT.Touch.TouchInput()};[/code


to initialize the touches array.  It works for me.

#5

Thanks Charlie, I will be testing this soon. I am just working on the new main board to support the G400.