Main Site Documentation

Glide: reference point (X,Y) appears inconsistent for various Glide Objects


#1

Hi,

I am finding that the Glide Designer will place a TextBlock, TextBox, Button all in a row using the same Y coordinate. So that they all appear in a neat horizontal line


<Glide Version="1.0.0">
  <Window Name="instance115" Width="320" Height="240" BackColor="FFFFFF">
    <Button Name="instance353" X="194" Y="104" Width="80" Height="32" Alpha="255" Text="Button" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
    <TextBlock Name="instance512" X="22" Y="104" Width="100" Height="32" Alpha="255" Text="TextBlock" TextAlign="Left" TextVerticalAlign="Middle" Font="4" FontColor="3"/>
    <TextBox Name="instance744" X="109" Y="104" Width="80" Height="32" Alpha="255" Text="" TextAlign="Left" Font="4" FontColor="000000"/>
  </Window>
</Glide>

However…

When you try and craft the same thing up using Button() TextBox(), TextBlock()

I am finding that the TextBox does NOT align, as it does not use the (TOP LEFT) reference point . But some arbitrary point elsewhere, which appear inconsistent with the Glide XML (i.e. Y=“104”),

Any thoughts on this please

all I am trying to do is create so0mething like:

Voltage [24.6 ] Vdc [SET]
TextBlock TextBox TextBlock Button

But they are not lining up horizontally, all objects have the same Height, Y properties


#2

Ive found that to align the textBox


            int iAdjustmentFudge = iFontPointSize + ((h -iFontPointSize) / 2) + 3;
            y = y + iAdjustmentFudge;

            TextBox(,,, y,..)

But this isn’t needed using the XML loader


#3

I have also discovered that the touch sensitivity of the textBox is BELOW the textBox (i.e. a higher Y value)
and not actually on the text box

so appears the display and touch are not working for this, yet …it works fine for every other type of touch sensitive object used (eg buttons) :-[


#4

When I ran your example XML it shows as below:


#5

Hi Josh,

The problem is that the XML works fine,
but when you hand craft a Window using the .AddChild() method using the same Y coordinates
it does not work!

Also the touch sensitive areas for the input is MISALIGNED!

Josh, is it possible to chat or skype you regarding this item, your 14hrs behind my local time) So I can only catch you generally between 9-10am your time (11-midnight my time)


#6

Skype is joshkyoung

<Glide Version="1.0.0">
  <Window Name="instance115" Width="320" Height="240" BackColor="FFFFFF">
  </Window>
</Glide>
using System.Threading;

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

namespace Test2
{
    public class Program
    {
        // This will hold the windows.
        static Window window;

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

            InitWin();

            // Activate touch
            GlideTouch.Initialize();

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

            Thread.Sleep(-1);
        }

        public static void InitWin()
        {
            Button button = new Button("button", 255, 194, 104, 80, 32);
            button.Text = "Button";
            window.AddChild(button);
            
            TextBox textBox = new TextBox("textBox", 255, 109, 104, 80, 32);
            window.AddChild(textBox);

            TextBlock textBlock = new TextBlock("textBlock", 255, 22, 104, 100, 32);
            textBlock.Text = "TextBlock";
            textBlock.TextVerticalAlign = VerticalAlignment.Middle;
            window.AddChild(textBlock);
        }
    }
}

#7

Hi Josh, as mentioned on Skype, I can get the example to work when the window uses the full LCD WxH, but as I am using multiple windows, it is not, any progress with the supplied project to see my problem?

in my upsidedpwn image:

The red Title area is a window
the white body (where the TextBox is displayed and attached) is a window
The grey status area is a window


#8

I also tried to run this on the emulator but I am getting the error

An unhandled exception of type ‘System.InvalidOperationException’ occurred in FEZCobra_GHIElectronics.NET.FEZ.dll

Additional information: FEZ Cobra not detected

I then was prompted in the ‘No source available’ tab
[ ] Always show dis assembly for missing source files
which I have now checked

When I then press continue I get a popup MSG:
Emulator
Error:Parameter is not valid

Then after a while the

popup:
Microsoft.SPOT.Emulator.Sample.SampleEmul… has stopped working
[Debug] [Close]

Any ideas? am I running the correct emulator for the Fez 480x272?


#9

The GHI hardware libraries are not supported in the emulator. Remove all references to the GHI hardware, and only include the Glide library.


#10

Thanks Mike


#11

also need to remove Microsoft.SPOT.Touch and disable following line of touch calibration code:

   Microsoft.SPOT.Touch.Touch.ActiveTouchPanel.SetCalibration(CAL_POINTS, sx, sy, cx, cy);

#12

Now that I am able to get the emulator working (of sorts):

the ORIGINAL problem still persists:

a) If you use XML to generate your page TextBox, TextBlock, Buttons all line up, GOOD
b) When you use hand crafted code to Addchild() to a Window the TextBox does not line up, when using the exact same Y coordinate as the TextBlock or Button.


#13

Alignment issues resolved in using Glide v1.0.1

But this has other issues, as it introduces magenta borders around textbox objects, even when you set background color and enable background , so hold off until that’s fixed

Don’t delete Glide 1.0.0 from your PC just yet.

But a great improvement