Touch Keyboard

I needed a simple touch keyboard for an idea I’m working on.  I created it in a simple helper class similar to my JoystickHelper class. I learned that the Display T35 module isn’t that accurate or fast.  The response time is very slow.  I’m not sure if this is due to the processor on the FEZ Spider or the display module itself.  The code is functional and works for my needs though.

Direct link to helper class:

Screenshot of the assembly

Touch Keyboard Assembly

A closeup of the keyboard shows that I’m handling Shift and Delete keys as well. I don’t handle special keys like brackets or slashes.  Maybe, I’ll add that in the future if needed.

Keyboard Closeup

Usage of the code is very simple. Create an instance of the keyboard helper with a font.

            KeyboardHelper keyboardHelper = new KeyboardHelper(display_T35,Resources.GetFont(Resources.FontResources.small));

Your code should be wired up to respond to the TextChanged event on the keyboard helper.

keyboardHelper.TextChanged += keyboardHelper_TextChanged;

The text changed event has an args which has the current text entered.

        void keyboardHelper_TextChanged(object sender, TextChangedEventArgs args)
            String text = args.Text;

I hope someone finds this useful. It was a bit challenging to write to handle the events unwiring properly to avoid memory leaks. I can aleady think of some ways to improve this. I really shouldn’t remove and recreate the keys when shifting. Rather, they should probably be on different panels with the shift key controlling visibility. I’m sure I’ll make this change next time I update this code.