Page 1 of 1

Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Thu Oct 25, 2012 2:33 pm
by 15663745
Hi,

I'm noticing some abnormalities with the CursorTool in all 2012 releases. If we set the CursorTool.XValue from code, the Cursor_Change event is not getting fired. Also setting the TeeChart's mouse cursor from code, doesn't have any effect. These were working properly until October 2011 release.

Now these issues are causing adverse effects in our existing code.
Here is the sample code:

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Steema.TeeChart.Tools;

namespace SampleCode
{
	public partial class Form1 : Form
	{
		private Steema.TeeChart.Styles.FastLine fastLine1;
		private Steema.TeeChart.Tools.CursorTool cursor1;
		private TextBox textBox1;
		private Label label1;
		private Button button1;

		private FlowLayoutPanel topPanel;

		public Form1()
		{
			InitializeComponent();

			topPanel = new FlowLayoutPanel();
			topPanel.Dock = DockStyle.Top;
			
			label1 = new Label();
			label1.Text = "Enter XValue:";
			topPanel.Controls.Add(label1);

			textBox1 = new TextBox();
			topPanel.Controls.Add(textBox1);

			button1 = new Button();
			button1.Text = "Move CursorTool";
			button1.AutoSize = true;
			button1.Click += new EventHandler(button1_Click);
			topPanel.Controls.Add(button1);

			this.Controls.Add(topPanel);
			this.Load += new EventHandler(Form1_Load);
			
		}

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;

			fastLine1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
			fastLine1.LinePen.Width = 2;
			fastLine1.FillSampleValues(20);

			cursor1 = new CursorTool(tChart1.Chart);
			cursor1.FollowMouse = false;
			cursor1.Style = CursorToolStyles.Vertical;
			cursor1.Change += new CursorChangeEventHandler(cursor1_Change);

			tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
			tChart1.Draw();
		}

		void Form1_Load(object sender, EventArgs e)
		{
			InitializeChart();
		}

		void tChart1_MouseDown(object sender, MouseEventArgs e)
		{
			//Even this is not working; this was working fine until October 2011 release
			tChart1.Cursor = Cursors.Hand;
		}

		void button1_Click(object sender, EventArgs e)
		{
			if(!string.IsNullOrWhiteSpace(textBox1.Text))
			{
				//Cursor gets moved. But this should fire the cursor1_change event as well; but not happening
				//This was working properly until October 2011 release
				cursor1.XValue = double.Parse(textBox1.Text);
			}
		}

		void cursor1_Change(object sender, CursorChangeEventArgs e)
		{
			MessageBox.Show(cursor1.XValue.ToString());
		}
	}
}
Please provide us a fix as early as possible.

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Thu Oct 25, 2012 3:32 pm
by 10050769
Hello Sugan,

I recommend you taking a look in next link, where is explained the problem isn't a bug.

Thanks,

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Fri Oct 26, 2012 5:54 am
by 15663745
Hi Sandra,

That reply doesn't sound to be correct/clear. When the XValue of the CursorTool is changed, the Cursor_Change event should get fired. That's how it was working and most of the code that we use follow this approach. Now all of a sudden if the behaviour is changed, this breaks the backward compatibility of TeeChart. Could you please explain for what reasons, firing this event is suppressed when setting the value from code ?

Also, if setting the chart's mouse Cursor property will not take effect, then why do we need that property ?

Since these were working properly in the earlier releases, this looks like a bug introduced in the 2012 releases. Please re-validate your response and provide us a solution.
Thanks.

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Fri Oct 26, 2012 11:40 am
by 10050769
Hello Sugan,

Sorry for my confusion. We have considered it as a bug and it is already fixed for next maintenance release of TeeChartFor.Net. On other hand, at the moment, you can use next workaround to solve the problem:

Code: Select all

void button1_Click(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(textBox1.Text))
{
//Cursor gets moved. But this should fire the cursor1_change event as well; but not happening
//This was working properly until October 2011 release
cursor1.XValue = double.Parse(textBox1.Text);
cursor1_Change(cursor1, null);
}
I hope will helps.

Thanks,

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Fri Oct 26, 2012 12:14 pm
by 15663745
Thanks Sandra.
We are waiting for the release.

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Fri Oct 26, 2012 2:17 pm
by 10050769
Hello Sugan,
Also, if setting the chart's mouse Cursor property will not take effect, then why do we need that property ?
We added it in bug list report with number[TF02016392]. We will try to fix it to upcoming versions of TeeChartFor.Net.

Thanks,

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Fri Dec 28, 2012 11:07 am
by 15663745
Hi,

We are waiting for a fix for this issue.
May I know, when is the next service release planned ?

Regards,
Sugan

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Fri Dec 28, 2012 11:35 am
by 10050769
Hello Sugan,

The bug number [TF02016392] isn't still fixed. I can not provided you a estimate date because the time we need to fix the bugs depends on any variables such as the complexity of the problem, the number of issues with even higher priority that claims our team attention. We will try to fix these to upcoming versions of TeeChartFor.Net. I recommend you to be aware at this forum, our RSS news feed, twitter and facebook accounts for new release announcements and what's implemented on them.

Thanks,

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Thu Jan 24, 2013 9:59 am
by 10050769
Hello Sugan,


Ok. I communicate you that after investigate your problem, we don't consider the bug number [TF02016392] as a bug, because in lastest versions we have changed the functionality and now you need use cursor1_Charge(cursor1,null) or add cursor1.OrinigalCursor=null in MouseDown if you want it works as do in TeeChartFor.Net 2011. See next code:

Code: Select all

  void tChart1_MouseDown(object sender, MouseEventArgs e)
      {
         //Even this is not working; this was working fine until October 2011 release
         cursor1.OriginalCursor = null;
         tChart1.Cursor = Cursors.Hand;
      }

Thanks,

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Tue Feb 05, 2013 12:34 pm
by 15663745
Hi Sandra,

I don't think this is fair and works for my problem. I believe any change done to libraries like TeeChart should be backward compatible, so that when people upgrade to latest versions, it still supports the older code without much modifications.

For the first problem that I have reported, calling cursor1_Change cannot be considered as an equivalent of the Change event getting fired, since there can be event handlers available in different modules other than the place where the value is set.
Also for the second problem, cursor1.OriginalCursor = null cannot help us, since we are talking about setting tChart1.Cursor = Cursors.Hand on mouse down event of the TChart, where cursor1 is no way need to be available. That is, what if I don't have a CursorTool itself on my chart and I want to set a different mouse cursor when the user presses the mouse button on the Chart.

I hope you would understand. Because of this issue, even though we have our support licenses for 2012, we are not able to use any of the 2012 releases.
Also, every other issue we raise, either we get a reply say it is partially implemented or it's a functionality change. This makes us disappointed about the fidelity of the TeeChart releases.

Please do the needful.

Thanks,
Sugan

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Tue Feb 05, 2013 4:47 pm
by 10050769
Hello Sugan,
For the first problem that I have reported, calling cursor1_Change cannot be considered as an equivalent of the Change event getting fired, since there can be event handlers available in different modules other than the place where the value is set.
As told you the problem is already fixed in last maintenance release of TeeChartFor.Net. The code I suggested you, is a workaround, but it is not necessary in last version we have published in 31 of January, because the problem is fixed in it. You can download latest version of TeeChartFor.Net in download page.
Also for the second problem, cursor1.OriginalCursor = null cannot help us, since we are talking about setting tChart1.Cursor = Cursors.Hand on mouse down event of the TChart, where cursor1 is no way need to be available. That is, what if I don't have a CursorTool itself on my chart and I want to set a different mouse cursor when the user presses the mouse button on the Chart.
So we change the functionality, now you need add cursor1.OriginalCursor=null if you want work in correct way when you have a cursor tool in your Chart. My recommendation is, if you want prevent possible problems, you must add a condition in MouseDown to check if there is cursor tool or not, the same way I have made in your code that works fine for me:

Code: Select all

 private Steema.TeeChart.Styles.FastLine fastLine1;
      private Steema.TeeChart.Tools.CursorTool cursor1;
      private TextBox textBox1;
      private Label label1;

      private FlowLayoutPanel topPanel;

     public Form1()
      {
         InitializeComponent();

         topPanel = new FlowLayoutPanel();
         topPanel.Dock = DockStyle.Top;
         
         label1 = new Label();
         label1.Text = "Enter XValue:";
         topPanel.Controls.Add(label1);

         textBox1 = new TextBox();
         topPanel.Controls.Add(textBox1);

         button1 = new Button();
         button1.Text = "Move CursorTool";
         button1.AutoSize = true;
         button1.Click += new EventHandler(button1_Click);
         topPanel.Controls.Add(button1);

         this.Controls.Add(topPanel);
         this.Load += new EventHandler(Form1_Load);
         
      }

      private void InitializeChart()
      {
         tChart1.Aspect.View3D = false;

         fastLine1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
         fastLine1.LinePen.Width = 2;
         fastLine1.FillSampleValues(20);

         cursor1 = new CursorTool(tChart1.Chart);
         cursor1.FollowMouse = false;
         cursor1.Style = CursorToolStyles.Vertical;
         cursor1.Change += new CursorChangeEventHandler(cursor1_Change);

         tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
         tChart1.Draw();
      }

      void Form1_Load(object sender, EventArgs e)
      {
         InitializeChart();
      }

      void tChart1_MouseDown(object sender, MouseEventArgs e)
      {
         //Even this is not working; this was working fine until October 2011 release
          if ((tChart1.Tools[0] as Steema.TeeChart.Tools.CursorTool) != null)
          {
              cursor1.OriginalCursor = null;
              tChart1.Cursor = Cursors.Hand;
          }
          else
          {
              tChart1.Cursor = Cursors.Hand;
          }
      }

      void button1_Click(object sender, EventArgs e)
      {
         if(!string.IsNullOrWhiteSpace(textBox1.Text))
         {
            //Cursor gets moved. But this should fire the cursor1_change event as well; but not happening
            //This was working properly until October 2011 release
            cursor1.XValue = double.Parse(textBox1.Text);
         }
      }

      void cursor1_Change(object sender, CursorChangeEventArgs e)
      {
         MessageBox.Show(cursor1.XValue.ToString());
      }
I hope you would understand. Because of this issue, even though we have our support licenses for 2012, we are not able to use any of the 2012 releases.
Also, every other issue we raise, either we get a reply say it is partially implemented or it's a functionality change. This makes us disappointed about the fidelity of the TeeChart releases.
If you consider there are some problems we haven't solved, please let me know what are these problems, because we can inform you for these state.

I hope will helps.

Thanks,

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Fri Feb 15, 2013 2:28 pm
by 15663745
Hi Sandra,

The solution that you provided (using cursor1.OriginalCursor = null) is not solving the problem when you have AnnotationTool or Rectangle added to the TeeChart. Not sure what other tools will have this problem.
I need some solution through which I can set a custom mouse cursor to the Chart control, irrespective of the tools added to that.

This was working fine in 2011 releases and I'm not sure how this can be considered a functionality change.
Please let me know how you can help me on this.

Thanks,
Sugan

Re: Abnormalities with TeeChart CursorTool in all 2012 releases

Posted: Thu Feb 21, 2013 11:49 am
by 10050769
Hello Sugan,

If you have a different types of Tools that allow you drag or modify the tool, you need check for each Tool if tool is cursor or not, to assign OriginalCursor =null, and change the TChart1.Cursor1 for each one. I have modify my previous code because works with Annotation Tool,but you can add more condition to treat all tools you consider can effect the change behavior. Please see next:

Code: Select all

  private Steema.TeeChart.Styles.FastLine fastLine1;
        private Steema.TeeChart.Tools.CursorTool cursor1;
        private Steema.TeeChart.Tools.Annotation annotation1;
        private TextBox textBox1;
        private Label label1;
        

        private FlowLayoutPanel topPanel;

        public Form1()
        {
            InitializeComponent();

            topPanel = new FlowLayoutPanel();
            topPanel.Dock = DockStyle.Top;

            label1 = new Label();
            label1.Text = "Enter XValue:";
            topPanel.Controls.Add(label1);

            textBox1 = new TextBox();
            topPanel.Controls.Add(textBox1);

            button1 = new Button();
            button1.Text = "Move CursorTool";
            button1.AutoSize = true;
            button1.Click += new EventHandler(button1_Click);
            topPanel.Controls.Add(button1);

            this.Controls.Add(topPanel);
            this.Load += new EventHandler(Form1_Load);

        }

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart1.Dock = DockStyle.Bottom;
            fastLine1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            fastLine1.LinePen.Width = 2;
            fastLine1.FillSampleValues(20);
           
            //Tools
            annotation1 = new Annotation(tChart1.Chart);
            cursor1 = new CursorTool(tChart1.Chart);
            cursor1.FollowMouse = false;
            cursor1.Style = CursorToolStyles.Vertical;
            cursor1.Change += new CursorChangeEventHandler(cursor1_Change);
            annotation1.AllowEdit = true;

            tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
            tChart1.Draw();
        }

        void Form1_Load(object sender, EventArgs e)
        {
            InitializeChart();
        }

        void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            //Even this is not working; this was working fine until October 2011 release
            foreach(Steema.TeeChart.Tools.Tool t in tChart1.Tools)
            {
                if (IsDragTool(t))
                {
                    if(t is Steema.TeeChart.Tools.CursorTool)
                    {
                         (t as Steema.TeeChart.Tools.CursorTool).OriginalCursor = null;
                           tChart1.Cursor = Cursors.Hand;
                    }
                    else if(t is Steema.TeeChart.Tools.Annotation)
                    {
                     
                         tChart1.Cursor = Cursors.Hand;
                    }
                 
                }
                else
                {
                    tChart1.Cursor = Cursors.Hand;
                }

            }

            
          
        }
   
        private bool IsDragTool(Steema.TeeChart.Tools.Tool t)
        {
            return ((t is Steema.TeeChart.Tools.RectangleTool) || (t is Steema.TeeChart.Tools.DragMarks) || (t is Steema.TeeChart.Tools.DragPoint) || (t is Steema.TeeChart.Tools.DrawLine)
                || (t is Steema.TeeChart.Tools.GanttTool) || (t is Steema.TeeChart.Tools.Annotation)) || (t is Steema.TeeChart.Tools.CursorTool);
        }

        void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(textBox1.Text))
            {
                //Cursor gets moved. But this should fire the cursor1_change event as well; but not happening
                //This was working properly until October 2011 release
                cursor1.XValue = double.Parse(textBox1.Text);
            }
        }

        void cursor1_Change(object sender, CursorChangeEventArgs e)
        {
            MessageBox.Show(cursor1.XValue.ToString());
        }
I hope will helps.

Thanks,