Page 1 of 1

changetype changes selectedindex in ChartListBox

Posted: Sun Jun 05, 2005 8:57 pm
by 8129925
Hi,
I created a series, and changed its series type at runtime, but the selectindex of ChartListBox is lost and reset to -1 afterwards. Is this a known bug? or supposed to be?

Code: Select all

chart.Series.Clear();
Steema.TeeChart.Styles.Series s0=chart.Series.Add(typeof(Steema.TeeChart.Styles.Points));
Steema.TeeChart.Styles.Series.ChangeType(ref s0,
				typeof(Steema.TeeChart.Styles.Line));
Assert.AreEqual(ChartListBox.SelectedIndex,0);
Best regards
Fang

Posted: Mon Jun 06, 2005 1:43 pm
by narcis
Hi Fang,

It works fine here using the code above and latest available version.

Code: Select all

		private void chartListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			chart.Header.Text=this.chartListBox1.SelectedIndex.ToString();
		}
Which TeeChart version are you using? If you are still having problems please send us an example we can run "as-is" to reproduce the problem here.

You can post your examples at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.

Posted: Tue Jun 07, 2005 7:53 pm
by 8129925
I used the same version in the download section.

But I created the chart and chartlistbox in the library class(not visually), not sure if it's related.

Posted: Wed Jun 08, 2005 11:27 am
by narcis
Hi Fang,

Could you please send us a complede complete example (form or project) we can run "as-is" to reproduce the problem here?

You can post it at the newsgroup I mentioned in my previous post.

Thanks in advance.

Posted: Thu Jun 09, 2005 6:03 pm
by 8129925
i just upload the attachment.

two project, one class libray, one app. You might need to relink the class library from app


Fang

Posted: Fri Jun 10, 2005 11:03 am
by narcis
Hi Fang,

Thank you very much for the example project.

the code above (with m_ChartListBox.FillSeries(null)) works:

Code: Select all

		public void TEST_HERE()
		{
			Steema.TeeChart.Styles.Series s=
				this.Series.Add(typeof(Steema.TeeChart.Styles.Points));
			int i=m_ChartListBox.SelectedIndex; // should be zero

			Steema.TeeChart.Styles.Series.ChangeType(ref s,
				typeof(Steema.TeeChart.Styles.Line));
			m_ChartListBox.FillSeries(null);
			int j=m_ChartListBox.SelectedIndex; // should be zero
		}