Glide touch events for buttons in a window do not fire. I am using a Cobra II, T43 display, .NETMF 4.3. I have a simple calibration project from the Glide examples. The button tap event never happens.
using System;
using System.Text;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using System.Threading;
using GHI.Glide;
using GHI.Glide.Display;
using GHI.Glide.UI;
using GHI.Glide.Geom;
using CalibrateUtilities;
namespace TestCalibrate
{
public class Program
{
// The windows.
static Window window;
static CalibrationWindow calWindow;
public static void Main()
{
// Load the window
window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));
// Activate touch
GlideTouch.Initialize();
CalibrateDisplays.CalibrateT43Display();
// Initialize the windows.
InitWin();
InitCalWin();
// 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()
{
Button btn = (Button)window.GetChildByName("btn");
// Open the calibration window.
btn.TapEvent += new OnTap(btn_TapEvent);
}
static void btn_TapEvent(object sender)
{
// Switch to calibration window.
Glide.MainWindow = calWindow;
}
static void InitCalWin()
{
// 1st argument is auto start, which immediately starts calibration once the window is open.
// 2nd argument is auto save, which saves the calibration settings for future restarts.
calWindow = new CalibrationWindow(false, false);
// Close the calibration window.
calWindow.CloseEvent += new OnClose(calWindow_CloseEvent);
}
static void calWindow_CloseEvent(object sender)
{
if (sender != null)
{
StringBuilder sb = new StringBuilder();
sb.Clear();
sb.Append("SX[] = ");
foreach (short val in calWindow.Settings.SX)
sb.Append(val.ToString() + ",");
Debug.Print(sb.ToString());
sb.Clear();
sb.Append("SY[] = ");
foreach (short val in calWindow.Settings.SY)
sb.Append(val.ToString() + ",");
Debug.Print(sb.ToString());
sb.Clear();
sb.Append("CX[] = ");
foreach (short val in calWindow.Settings.CX)
sb.Append(val.ToString() + ",");
Debug.Print(sb.ToString());
sb.Clear();
sb.Append("CY[] = ");
foreach (short val in calWindow.Settings.CY)
sb.Append(val.ToString() + ",");
Debug.Print(sb.ToString());
}
// Switch to normal window.
Glide.MainWindow = window;
}
}
}
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using GHI.Glide;
using GHI.Glide.Display;
using GHI.Glide.UI;
using GHI.Glide.Geom;
namespace CalibrateUtilities
{
public static class CalibrateDisplays
{
/// <summary>
/// Set calibration points for T43 display
/// </summary>
public static void CalibrateT43Display()
{
if (GlideTouch.CalSettings == null)
{
CalibrationSettings oCalSettings = new CalibrationSettings();
const int CAL_POINTS = 5;
//short[] sx = new short[CAL_POINTS] { 240, 48, 48, 432, 432 };
//short[] sy = new short[CAL_POINTS] { 136, 26, 246, 246, 26 };
//short[] cx = new short[CAL_POINTS] { 428, 130, 142, 821, 829 };
//short[] cy = new short[CAL_POINTS] { 438, 183, 807, 762, 196 };
short[] sx = new short[CAL_POINTS] { 240, 48, 48, 432, 432 };
short[] sy = new short[CAL_POINTS] { 136, 26, 246, 246, 26 };
short[] cx = new short[CAL_POINTS] { 478, 140, 142, 817, 828 };
short[] cy = new short[CAL_POINTS] { 462, 202, 785, 721, 168 };
Point[] Points = new Point[CAL_POINTS];
Points[0] = new Point(240, 136);
Points[1] = new Point(48, 26);
Points[2] = new Point(48, 246);
Points[3] = new Point(432, 246);
Points[4] = new Point(432, 26);
oCalSettings.CX = cx;
oCalSettings.CY = cy;
oCalSettings.SX = sx;
oCalSettings.SY = sy;
oCalSettings.Points = Points;
Touch.ActiveTouchPanel.SetCalibration(CAL_POINTS, sx, sy, cx, cy);
GlideTouch.CalSettings = oCalSettings;
}
}
}
}
<Glide Version="1.0.7">
<Window Name="window" Width="480" Height="272" BackColor="dce3e7">
<Button Name="btn" X="20" Y="20" Width="80" Height="32" Alpha="255" Text="Calibrate" Font="3" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
</Window>
</Glide>