Page 1 of 1

Only the last series triggers the Click event

Posted: Tue Jan 23, 2007 2:53 pm
by 8877100
I want to make my application respond to clicks on the series in the chart.
I have made event handlers like this

foreach (Steema.TeeChart.Styles.Series S in this.Chart.Series)
S.Click +=new MouseEventHandler(S_Click);

but when I click on the series, the S_Click() method is never called, except from when clicking on the last added series.

Am I doing something wrong here?

Thanks

Alan

Posted: Tue Jan 23, 2007 3:08 pm
by narcis
Hi Alan,

It works fine for me here using the latest TeeChart for .NET v2 maintenance release and this code:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			for (int i = 0; i < 5; i++)
			{
				tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
			}

			foreach (Steema.TeeChart.Styles.Series s in tChart1.Series)
			{
				s.FillSampleValues();
				s.Click += new MouseEventHandler(s_Click);
			}

		}

		void s_Click(object sender, MouseEventArgs e)
		{
			Steema.TeeChart.Styles.Series s = (Steema.TeeChart.Styles.Series)sender;

			label1.Text = tChart1.Series.IndexOf(s).ToString();
		}
Which TeeChart version are you using?

Posted: Thu Jan 25, 2007 9:13 am
by 8877100
I am using TeeChart for .NET v1

Posted: Thu Jan 25, 2007 9:43 am
by narcis
Hi Alan,

The code I posted also works fine for me here using the latest TeeChart for .NET v1 release available at the client area. Are you using the latest version available, which is Build 1.1.2531.28391 from 6th December 2006?

Posted: Thu Jan 25, 2007 1:19 pm
by 8877100
I have installed the latest build 1.1.2531.28391, but still, only clicks on the last serie who get the handle added, do trigger the handle.

Posted: Thu Jan 25, 2007 1:51 pm
by narcis
Hi Alan,

Have you tried running the example I posted? Does it work at your end? If the problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.

You can post your files either at news://www.steema.net/steema.public.attachments newsgroup or at our download page at http://www.steema.net/upload/.

Thanks in advance.