LCD touch screen as button

I was wondering if some one could point me toward learning how to use the touch screen as a button that will work like the button module. Is this even possible? I understand the process of making a windows form application to interact with the LCD but I would like to take it further if possible. Thanks

http://www.ghielectronics.com/glide

what I am not understanding is how or do you mix a console application and a Gadgeteer application

By “console application”, do you mean an application on your PC?

This is posted in the Gadgeteer forum, so I am assuming what you 're really wanting to do is mix a Gadgeteer app and use Glide for instance to represent a button. I don’t know the answer for you, but I can suggest you never want to start a new console project if you want graphics :slight_smile:

Perhaps all you really need to do is link OnPressed event handler on a button object that then initiates a directed response?

yes Brett that’s exactly what I am trying to do

No all the examples for using the touch screen have you start by making a console application which does not have the program generated.cs so I am guessing in order to use say the LED module I will have to add “things” sorry I am self taught on programming and I fear I missed some of the basics. Can I add module definitions and Initialize Modules all in the program.cs I know you can with other .NET microcontrolers please forgive my ignorance on this.
The Glide library is helpful though

It is easier for you and for us if you tell us what you own and what you are trying to do :slight_smile:

OK that makes sense
I want to have 3 buttons on the touch screen that will turn on an the LED module. Buttons labeled Red Blue Green and will turn the LED the color of the button pressed this is manly a learning practice for me.

I am using the Spider with the complete Gadgeteer kit

Sean,

Start with a Gadgeteer project. Download the Glide library source, compile it, and add a reference to the resulting DLL to your Gadgeteer project.

Then head over to the Glide designer, and drag three buttons onto the designer surface, and save the resulting XML. Make sure the buttons have IDs and you note what those IDs are.

Add the Glide XML to the resource file for the Gadgeteer project. When I’ve used Glide, I just add the XML as a named string resource. Once you have the string resource for a given screen in your project, you can load the screen using code like the following:

window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Screen1));

Then, in order to handle the button’s click/tap event, you need to get a reference to the button, like so:

// Get the Button
GHIElectronics.NETMF.Glide.UI.Button button = (GHIElectronics.NETMF.Glide.UI.Button)window.GetChildByName("Button");

then you just add a TapEvent handler, like so:

button.TapEvent += new OnTap(button_TapEvent);

where your event handler is called button_TapEvent. Alternately, you can just type button.TapEvent += and then hit TAB twice and the event handler will be created for you.

That should give you what you need. Note that all of the code above can be placed in the ProgramStarted() function.

The compiled DLLs are here http://www.ghielectronics.com/downloads/Glide/

I think we should add a little section to glide showing some sample on using spider (gadgeteer) with glide. It is very simple but it maybe challenging to someone who is just getting started.

We will try to get it up online on Tuesday. For now, we will be busy having champagne and celebrating the new year :slight_smile:

Cool thanks! After I figure all this out I will post a quick lesson on how to do this HAPPY NEW YEAR!

Sean,

Hope you don’t mind, but I took the liberty of posting some code to demo this over on the code site:

[url]http://code.tinyclr.com/project/411/glide-buttons-and-gadgeteer-demo/[/url]

If you’re doing the project as a learning exercise, I would suggest trying to code it up, and you can take a peek at my solution as a backup if you run into any problems. :slight_smile:

For an additional challenge, it might be fun to replace (or supplement) the buttons with sliders for each of the RGB channels and have the ability to infinitely adjust the RGB color on the LED.

That was the plan learn this then go on to the sliders COOL ! thanks

My pleasure…glad I could give back after all I’ve learned from your book. :slight_smile:

Here is a video of it in action

thanks for all the help now on to sliders and more fun colors

Looks like you are having fun :slight_smile:

Sean,

FYI, you can embed YouTube videos directly into the forum using the YouTube button in the editor toolbar, putting the video ID in between the brackets.

Nicely done swestcott!

@ swescott

Check out the updated Gadgeteer WiFi Scanner.
Lots of touchscreen visuals at play there.

@ Gus hope you don’t mind, but I’ve taken the 1.0.3 dll’s and turned them in to a nuget package. If you want to use Glide you can just add a reference now via nuget.

If you want control of the package I’ll transfer it you.