GUI using EMX and 3.5" Touchscreen LCD

Hi. I need to make a GUI for our thesis. Just a simple one :slight_smile: But I can’t find any decent tutorial, even a start-up turtorial. I’m using MS Visual Studio 2010. Can anyone help me on this? Just a simple start-up tutorial on how to make GUI would really really be helpful

one word: Glide. Great for UI development at speed.

Thank you :smiley: Can you suggest any references and examples I can check? Thanks again.

yep - go to the SUPPORT menu up above, and you’ll find it on the RESOURCES section.

Visit this page, it has some explanations:

http://www.ghielectronics.com/glide/

Once you have downloaded Glide, open it in Visual Studio and you will find “Examples” folder in the project.

“To get started download the following files:
Download the source codes from CodePlex — http://netmfglide.codeplex.com
-You must compile the source codes to generate the needed DLLs.
-In the project’s properties under the Application tab, you’ll need to change the Target Framework to the current version of .NET Micro Framework.”

I DLed the latest source codes from CodePlex. I don’t actually know how to compile it to generate the DLLS. In short I don’t know how to set it up. Can you enlighten me with about this.

SUper thnaks!

  1. Visit Support – GHI Electronics
  2. Download and install Microsoft .NET Micro Framework 4.1 SDK
  3. Download and install GHI NETMF v4.1 and .NET Gadgeteer Package.
  4. Open Glide project in Visual Studio. Go to (Menu) Build->Configuration manager, choose “release” in “Active debug configurations” box.
  5. In the project’s properties under the Application tab, you’ll need to change the Target Framework to the current version of .NET Micro Framework." — That’ll be 4.1
  6. Press F6 to build. Hopefully it builds (for me it does).
  7. You will find GHIElectronics.NETMF.Glide.dll file in (your glide prject location)/bin/Release. That is your DLL :slight_smile:
  8. Start a new .NET Micro framework project (you haven’t specified your hardware, but generic “Console application” should be ok. As far as I remember, Glide also works on emulator). Add the glide dll to references.
  9. Copy code from Glide Examples folder (there are plenty of xml files there, code is inside with comments).
  10. Pretty much it! Open you project’s properties, go to “.NET Micro framework” tab, select your device (or emulator), hit F5 and enjoy it :slight_smile:

If you have Visual Studio Professional (or even better), you can just create a new project (as per step 8), and add Glide project to the solution (do not forget to add reference to Glide project), instead of building it separately. It is much easier when you may have a couple projects in a solution (this is not allowed by Express version of Visual Studio).

I’ll be using FEZ Cobra OEM Box (3.5" Display) :smiley: But only the display, I’ll be attaching it to the EMX Module.

WOAH, super thanks for that very detailed instruction. Really helpful :slight_smile:

Hi, I tried to run this on FEZ Cobra: http://www.ghielectronics.com/glide/example/2/

I followed the instructions in the site. But it keeps on giving me these errors:

Error 1 The type or namespace name ‘CodeDom’ does not exist in the namespace ‘System’ (are you missing an assembly reference?)
Error 3 The type or namespace name ‘CompilerGeneratedAttributeAttribute’ does not exist in the namespace ‘System.Runtime.CompilerServices’ (are you missing an assembly reference?)
Error 6 The type or namespace name ‘CodeAnalysis’ does not exist in the namespace ‘System.Diagnostics’ (are you missing an assembly reference?

I don’t know what reference are they talking about. Can you help me with this one. I’m usung the FEZ Cobra Window Application.

You need to talk to Skewworks. His Tinkr controls will be released very soon and he can probably get you going now. His controls are much nicer than Glide.

Working on the last little annoyance now and then it’s release time. Auto-scrolling on containers is having a little issue, once that’s resolved everything goes live. There’s also Pyxis 2 & Gadgetos for free.

With all due respect to the said To Mr Skewworks and the others, I need to finish this by early next week :< Otherwise, I’ll flunk.

I need something that is easy to learn, and found Glide which is really acting up on me.

Can you help me on this?

These are very strange errors. I somehow doubt it is related with Glide itself. Have you tried other, simplier, Glide examples? Are they working?

And where are errors 2, 4 and 5? :slight_smile:

[/quote]


Yes, I tried the Simple Example and it worked. However when I add a reference, like a text file for the XML like what the instructions said it the website. It gives out the errors I showed here. They were all in Resource.Design.cs


I tried to compile the Button Example in the Examples folder in Glide. These are all the errors I got. All are from Resource.Design.cs

Error 1 The type or namespace name ‘CodeDom’ does not exist in the namespace ‘System’ (are you missing an assembly reference?) c:\users\katherine\documents\visual studio 2010\Projects\Button Example\Button Example\Resources.Designer.cs 22 21 Button Example
Error 2 The type or namespace name ‘CodeDom’ does not exist in the namespace ‘System’ (are you missing an assembly reference?) c:\users\katherine\documents\visual studio 2010\Projects\Button Example\Button Example\Resources.Designer.cs 22 21 Button Example
Error 3 The type or namespace name ‘CompilerGeneratedAttributeAttribute’ does not exist in the namespace ‘System.Runtime.CompilerServices’ (are you missing an assembly reference?) c:\users\katherine\documents\visual studio 2010\Projects\Button Example\Button Example\Resources.Designer.cs 24 46 Button Example
Error 4 The type or namespace name ‘CompilerGeneratedAttribute’ does not exist in the namespace ‘System.Runtime.CompilerServices’ (are you missing an assembly reference?) c:\users\katherine\documents\visual studio 2010\Projects\Button Example\Button Example\Resources.Designer.cs 24 46 Button Example
Error 5 The type or namespace name ‘CodeAnalysis’ does not exist in the namespace ‘System.Diagnostics’ (are you missing an assembly reference?) c:\users\katherine\documents\visual studio 2010\Projects\Button Example\Button Example\Resources.Designer.cs 31 37 Button Example
Error 6 The type or namespace name ‘CodeAnalysis’ does not exist in the namespace ‘System.Diagnostics’ (are you missing an assembly reference?) c:\users\katherine\documents\visual studio 2010\Projects\Button Example\Button Example\Resources.Designer.cs 31 37 Button Example

They were same errors I got. I don’t know hoe to fix it since I think as stated in the Resource.Design.cs, the code was auto generated. Here is the whole code:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.269
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Button_Example {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public class Resources {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Button_Example.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Hello World!.
        /// </summary>
        public static string String1 {
            get {
                return ResourceManager.GetString("String1", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to <Glide Version="x.x.x">
        ///  <Window Name="window" Width="320" Height="240" BackColor="dce3e7">
        ///    <Button Name="btn" X="100" Y="104" Width="120" Height="32" Alpha="255" Text="Click me" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
        ///  </Window>
        ///</Glide>.
        /// </summary>
        public static string Window {
            get {
                return ResourceManager.GetString("Window", resourceCulture);
            }
        }
    }
}

Using code tags will make your post more readable. This can be done in two ways:[ol]
Click the “101010” icon and paste your code between the

 tags or...
Select the code within your post and click the "101010" icon.[/ol]
(Generated by QuickReply)
Hi @ Katyutoc, can you edit your post and wrap the code block with CODE tags (highlight the code, hit the 101010 icon).

Sorry :smiley: There you go, I edited already.

I did something:

  1. I erased the Resource.Design.cs
  2. Build the code

And the errors were gone! However, I got this instead:
Error 1 ‘GHIElectronics.NETMF.Glide.Resources’ is inaccessible due to its protection level c:\users\katherine\documents\visual studio 2010\Projects\Button Example\Button Example\Program.cs 19 45 Button Example

I’m confused because I have Acess Modifier already as Public.

How can I fix this?

And thank you so much for answering my questions :slight_smile:

Strange. My Resources.Designer.cs file looks totally different…

You are running into problems that, from my experience, only show when some core pieces are accidentaly messed up. My suggestions:

  1. If you can run a simple Glide applications, but not that multiple windows example, it probably means you are doing something wrong when adding resources.
  2. Perhaps it is time to start over. Try other project types. Generic .NETMF “Window application” should work perfectly, as well as “EMX application”.
  3. Don’t touch Resource.Designer.cs file.
  4. Execute “Clean” command.

Show us the code line that throws this error…

Here is the Button Example I’m trying to accomplish. I did exactly what was written here:

<?xml version="1.0" encoding="utf-8" ?>

Create a new .NET Micro Framework project using the Console Application template and call it “Test”.
Next, open Resources.resx, select Add Resource and click Add New Text File.
In the prompt, name the new resource “Window” and click Add.
Now, copy the XML below and paste it into the file and save.

<Glide Version="x.x.x">
  <Window Name="window" Width="320" Height="240" BackColor="dce3e7">
    <Button Name="btn" X="100" Y="104" Width="120" Height="32" Alpha="255" Text="Click me" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
  </Window>
</Glide>

Open Program.cs and replace the code with the code below:

using System.Threading;

using Microsoft.SPOT;

using GHIElectronics.NETMF.Glide;
using GHIElectronics.NETMF.Glide.Display;
using GHIElectronics.NETMF.Glide.UI;

namespace Test
{
    public class Program
    {
        // This will hold the main window.
        static Window window;

        public static void Main()
        {
            // Load the window
            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));

            // Activate touch
            GlideTouch.Initialize();

            // Initialize the window.
            InitWin();

            // Assigning a window to MainWindow flushes it to the screen.
            // This also starts event handling on the window.
            Glide.MainWindow = window;

            Thread.Sleep(-1);
        }

        static void InitWin()
        {
            // Get the Button
            Button btn = (Button)window.GetChildByName("btn");

            // Listen for tap events
            btn.TapEvent += new OnTap(btn_TapEvent);
        }

        // Handle tap events
        static void btn_TapEvent(object sender)
        {
            Debug.Print("I can perform an action!");
        }

    }
}

Before we run it, we must add the Glide reference by right-clicking References and selecting Add Reference.
In the new window select the Browse tab, locate GHIElectronics.NETMF.Glide and click Ok.
Now that everything is ready, press F5 to run the example.


The error is for this line:

// Load the window
            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));

Katy, what framework version did you target when you created the Glide DLL ? What version is your project targeting? and what version firmware do you have on the Cobra?

I get it now. Resources is not a static class, you cannot call it directly. Change it to:

// Load the window
            window = GlideLoader.LoadWindow(MY_PROJECT_NAME.Resources.GetString(MY_PROJECT_NAME.Resources.StringResources.Window));

Of course, chage MY_PROJECT_NAME to what is your project named.