is this possible I have a value entered in to a TextBox that I want to set the the value for led.SetRedIntensity(some value)
this is what I have
Thanks
using System;
using System.Text;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
using GHIElectronics.NETMF.Glide;
using GHIElectronics.NETMF.Glide.Display;
using GHIElectronics.NETMF.Glide.UI;
namespace RGBadjustTextBox
{
public partial class Program
{
static GHIElectronics.NETMF.Glide.Display.Window window;
void ProgramStarted()
{
// Do one-time tasks here
Debug.Print("Program Started");
GlideTouch.Initialize();
// Load the Window XML string.
window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));
// Resize any loaded Window to the LCD's size.
Glide.FitToScreen = true;
// Assign the Window to MainWindow; rendering it to the LCD.
Glide.MainWindow = window;
// Get the Buttons
GHIElectronics.NETMF.Glide.UI.Button LoadColor = (GHIElectronics.NETMF.Glide.UI.Button)window.GetChildByName("LoadColor");
// Get the TextBox
GHIElectronics.NETMF.Glide.UI.TextBox redNum = (GHIElectronics.NETMF.Glide.UI.TextBox)window.GetChildByName("redNum");
GHIElectronics.NETMF.Glide.UI.TextBox greenNum = (GHIElectronics.NETMF.Glide.UI.TextBox)window.GetChildByName("greenNum");
GHIElectronics.NETMF.Glide.UI.TextBox blueNum = (GHIElectronics.NETMF.Glide.UI.TextBox)window.GetChildByName("blueNum");
// Add a tap event handler to open the keyboard.
redNum.TapEvent += new OnTap(Glide.OpenKeyboard);
greenNum.TapEvent += new OnTap(Glide.OpenKeyboard);
blueNum.TapEvent += new OnTap(Glide.OpenKeyboard);
// Add a value changed handler.
redNum.ValueChangedEvent += new OnValueChanged(redNum_ValueChangedEvent);
greenNum.ValueChangedEvent += new OnValueChanged(greenNum_ValueChangedEvent);
blueNum.ValueChangedEvent += new OnValueChanged(blueNum_ValueChangedEvent);
// Set up event handlers
LoadColor.TapEvent += new OnTap(LoadColor_TapEvent);
}
void blueNum_ValueChangedEvent(object sender)
{
TextBox blueNum = (TextBox)window.GetChildByName("blueNum");
Debug.Print(blueNum.Text);
}
void greenNum_ValueChangedEvent(object sender)
{
TextBox greenNum = (TextBox)window.GetChildByName("greenNum");
Debug.Print(greenNum.Text);
}
void redNum_ValueChangedEvent(object sender)
{
TextBox redNum = (TextBox)window.GetChildByName("redNum");
Debug.Print(redNum.Text);
}
void LoadColor_TapEvent(object sender)
{
//string strB = ("blueNum");
byte b = Convert.ToByte("blueNum");
//string strG = ("greenNum");
byte g = Convert.ToByte("greenNum");
// string strR = ("redNum");
byte r = Convert.ToByte("redNum");
led.SetRedIntensity(r);
led.SetBlueIntensity(g);
led.SetBlueIntensity(b);
}
}
}