EndDragLine event sent multiple times for no reason

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Michal Blazejczyk
Newbie
Newbie
Posts: 64
Joined: Fri Jun 16, 2006 12:00 am

EndDragLine event sent multiple times for no reason

Post by Michal Blazejczyk » Tue Apr 10, 2007 7:36 pm

Hi,

I'm using TeeChart version 2.0.2546.16098. I have a chart where I create (programatically) 7 (seven) ColorLines. Each of them has AllowDrag = true. Six of them are vertical and one is horizontal. All of them use the EndDragLine event:

Code: Select all

Steema.TeeChart.Tools.ColorLine line = new Steema.TeeChart.Tools.ColorLine();
line.Active = true;
line.AllowDrag = true;
line.Axis = ( isHorizontalLine ? chart.Axes.Left : chart.Axes.Bottom );
line.Draw3D = false;
line.DrawBehind = false;
line.Pen.Color = someColor;
line.Value = someValue;
line.EndDragLine
    += new Steema.TeeChart.Tools.ColorLineToolOnDragEventHandler( OnLineMoved );
chart.Tools.Add( line );
When the user drags one of the lines, the event handler is invoked seven times, i.e. for each line - even though only one line was dragged.

Are we doing something wrong or is this (a) a bug, or (b) desired behaviour and we have to live with it?

Best,
Michal Blazejczyk
Best,
Michal Blazejczyk
Lead Programmer
Genome Quebec

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Wed Apr 11, 2007 10:00 am

Hi Michal

I could reproduce the issue here and this seems to be a bug. I've added it (TF02012165) to our defect list to be fixed for future releases.

In the meantime, a workaround can be to use the "DragLine" event to know which is the ColorLine, for example:

Code: Select all

 private void Form1_Load(object sender, EventArgs e)
        {
            line1.FillSampleValues();
            tChart1.Aspect.View3D = false;
            
            for (int i = 0; i < 7; i++)
            {
                Steema.TeeChart.Tools.ColorLine ColorLine = new Steema.TeeChart.Tools.ColorLine();
                ColorLine.Active = true;
                ColorLine.AllowDrag = true;
                ColorLine.Axis = (i == 0 ? tChart1.Axes.Left : tChart1.Axes.Bottom);
                ColorLine.Draw3D = false;
                ColorLine.DrawBehind = false;
                ColorLine.Pen.Color = Color.Green;
                ColorLine.Value = i;
                ColorLine.DragLine += new EventHandler(ColorLine_DragLine);
                ColorLine.EndDragLine += new Steema.TeeChart.Tools.ColorLineToolOnDragEventHandler(ColorLine_EndDragLine);
                tChart1.Tools.Add(ColorLine);
            }
        }
        
        private int CurrentColorLine = 0;
        
        void ColorLine_DragLine(object sender, EventArgs e)
        {
            int i = 1;
            foreach (Steema.TeeChart.Tools.ColorLine cl in tChart1.Tools)
            {
                if (cl == sender)
                {
                    CurrentColorLine = i;
                    break;
                }
                i++;
            }
        }

        void ColorLine_EndDragLine(object sender)
        {
            int i = 1;
            foreach (Steema.TeeChart.Tools.ColorLine cl in tChart1.Tools)
            {
                if (i==CurrentColorLine)
                {
                    //Now cl is the tool, which has been dragged
                    listBox1.Items.Add("Event: " +i.ToString());
                    break;
                }
                i++;
            }
            CurrentColorLine = 0;
        }
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Michal Blazejczyk
Newbie
Newbie
Posts: 64
Joined: Fri Jun 16, 2006 12:00 am

Post by Michal Blazejczyk » Thu Apr 12, 2007 8:44 pm

A related question: while a ColorLine is being dragged, it is not visible on the screen, even if the mouse doesn't move. Is this normal?

Best,
Michal
Best,
Michal Blazejczyk
Lead Programmer
Genome Quebec

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 13, 2007 10:03 am

Hi Michal,

I'm not able to reproduce this here using the latest version available at the client area. Please notice that a new version was posted on Friday 6th April 2007. Could you please check if this version solves the problem at your end?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Michal Blazejczyk
Newbie
Newbie
Posts: 64
Joined: Fri Jun 16, 2006 12:00 am

Post by Michal Blazejczyk » Fri Apr 13, 2007 4:43 pm

I switched to version 2.0.2652.22324 a couple days ago and the problem still happens there. When I start dragging a ColorLine, it isn't painted anymore and the mouse cursor flickers between the arrow and the hourglass.

Best,
Michal
Best,
Michal Blazejczyk
Lead Programmer
Genome Quebec

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 16, 2007 7:53 am

Hi Michal,

I'm still unable to reproduce the issue here. Would you be so kind to send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply