Main Site Documentation

Glide sliders very erratic


#1

On a window I am using two Glide sliders and they both are very erratic.
Touch response for all Buttons on this window appear OK.

Any secrets I should know about coding for the sliders? When touched, the knob jumps all over and even goes out of the bounds of the control (Usually left of zero position). The knob remains on the same horizontal plane and sometimes disappears.

If it matters, I am using two window views (The windows switch on a button press)



//I put a line space to separate the slider code. No line space in actual resources file.
//KnobSize="20" default was changed to 18 only as a test.

<Glide Version="1.0.6">
  <Window Name="Window2" Width="320" Height="240" BackColor="FFFFFF">

    <Slider Name="count5" X="70" Y="180" Width="210" Height="30" Alpha="255" Direction="horizontal" SnapInterval="5" TickInterval="5" TickColor="000000" KnobSize="18" Minimum="1" Maximum="5" Value="1"/>

    <Slider Name="count10" X="70" Y="135" Width="210" Height="30" Alpha="255" Direction="horizontal" SnapInterval="10" TickInterval="10" TickColor="000000" KnobSize="18" Minimum="1" Maximum="10" Value="1"/>

    <Button Name="View1" X="253" Y="44" Width="60" Height="32" Alpha="255" Text="View 1" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
    <TextBox Name="TB2" X="5" Y="5" Width="310" Height="32" Alpha="255" Text="Slider selects Row in list - (50 Rows)" TextAlign="Center" Font="4" FontColor="000000"/>
    <Button Name="Speak" X="120" Y="87" Width="70" Height="32" Alpha="255" Text="Speak Line" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
    <TextBox Name="value" X="11" Y="149" Width="40" Height="32" Alpha="255" Text="0" TextAlign="Left" Font="4" FontColor="000000"/>
    <Button Name="SendToSpider" X="15" Y="87" Width="90" Height="32" Alpha="255" Text="To Spider" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
    <Button Name="EraseLine" X="214" Y="87" Width="80" Height="32" Alpha="255" Text="Erase Line" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
    <Button Name="SendToList" X="15" Y="44" Width="90" Height="32" Alpha="255" Text="To List" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
  </Window>
</Glide>


The methods for both windows are NOT inside of ProgramStarted() { }


//
        //Windows[1] "Window2"
        //Slider Name="count5"
        //Slider Name="count10"
        
        private GBTN btnV1;
        private GBTN btnSPK;
        private GBTN btnSTS;
        private GBTN btnEL;
        private GBTN btnSTL;
        private GTBX Text2;
        private GTBX TextV;
        private GSlide GS5;
        private GSlide GS10;

        private void DoButtons2()
        {
            // Load the Window XML string.
            windows[1] = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window2));
            windows[1].BackColor = Microsoft.SPOT.Presentation.Media.ColorUtility.ColorFromRGB(51, 204, 255);
            Glide.MainWindow = windows[1];
            Glide.FitToScreen = true;
            
            //Text at top of display
            Text2 = (GTBX)windows[1].GetChildByName("TB2");
            TextV = (GTBX)windows[1].GetChildByName("value");

            btnV1 = (GBTN)windows[1].GetChildByName("View1");
            btnSPK = (GBTN)windows[1].GetChildByName("Speak");
            btnSTS = (GBTN)windows[1].GetChildByName("SendToSpider");
            btnEL = (GBTN)windows[1].GetChildByName("EraseLine");
            btnSTL = (GBTN)windows[1].GetChildByName("SendToList");

            btnV1.TapEvent += new OnTap(btnV1_TapEvent);
            btnSPK.TapEvent += new OnTap(btnSPK_TapEvent);
            btnSTS.TapEvent += new OnTap(btnSTS_TapEvent);
            btnEL.TapEvent += new OnTap(btnEL_TapEvent);
            btnSTL.TapEvent += new OnTap(btnSTL_TapEvent);

            GS5 = (GHIElectronics.NETMF.Glide.UI.Slider)windows[1].GetChildByName("count5");
            GS10 = (GHIElectronics.NETMF.Glide.UI.Slider)windows[1].GetChildByName("count10");
            GS5.ValueChangedEvent += new OnValueChanged(GS5_ValueChangedEvent);
            GS10.ValueChangedEvent += new OnValueChanged(GS10_ValueChangedEvent);

            windows[1].Invalidate();
        }

        private static Double val = 0;
        private static Double multiplier = 0;

        void GS5_ValueChangedEvent(object sender)
        {
            DoMul();
        }
        //
        void GS10_ValueChangedEvent(object sender)
        {
            DoMul(); 
        }
        //
        void DoMul()
        {
            multiplier = GS10.Value;
            val = GS5.Value * multiplier;
            TextV.Text = System.Math.Round(val).ToString();
            TextV.Render();
            windows[1].Render();
            windows[1].Invalidate();
        }
        //

        void btnV1_TapEvent(object sender)
        {
            //Recreate windows[0] 
            //DoButtons1()

            //Not sure I need/will use this.. For testing at the moment
            Tween.SlideWindow(windows[1], windows[0], Direction.Down);
        }


windows[1].Render(), windows[1].Invalidate() added/removed to see if it made any difference. It did not make any difference.

The method DoButtons2() is called each time the windows[1] is made (Requested by a button press from windows[0]). Windows[0] is recalled by a button press from windows[1]

Thanks for suggestions


#2

What touch screen are you using and what mainboard as it might make a difference.


#3

@ Duke Nukem -

What touch screen are you using and what mainboard as it might make a difference.
You have a point there!

Fez Spider with T35 display. Everything works well except for the Sliders.


#4

I remember a similar problem with the slider
try to set the minimum to “0”


#5

@ VB-Daniel -

Thanks for the tip…
Can’t do it now… Baby sitting grandchild. Will try tomorrow or late tonight.


#6

@ VB-Daniel -

The zero seems to stop the knob from running off the end of the control.

Still very erratic on touch though.

I’ll have to work on that…

Thanks