Page 1 of 1

Example with CloseEditor event

Posted: Wed Oct 26, 2011 10:50 pm
by 15660151
Would it be possible to see an example of C# code using the Chart Editor's CloseEditor event?

I maintain a DataGrid which shows the chart series, along with names of the objects that will provide data for each Series.

If a user opens the chart editor and adds a Series, and then closes the editor, I am planning on using the CloseEditor event to re-scan the Series in the chart and update my DataGrid accordingly.

Thanks for your time!

Marc.

Re: Example with CloseEditor event

Posted: Thu Oct 27, 2011 2:36 pm
by 15660151
Answering my own question, although it doesn' t work if user right-clicks on chart and chooses Edit. Only works with custom button where I control how the editor gets called and displayed.

Code: Select all


        static void RefreshDataSources(object sender, EventArgs e)
        {
            MessageBox.Show("in Refresh");
            return;
        }

        private void tspDataSourceNew_Click(object sender, EventArgs e)
        {
            //Need to maintain which tab is selected.
            Steema.TeeChart.TChart tChart = (Steema.TeeChart.TChart)chartBook1.TabPages[0].Controls[0];
            Steema.TeeChart.Editor ed = new Steema.TeeChart.Editor(tChart);
            ed.CloseEditor += new EventHandler(RefreshDataSources);
            ed.ShowModal(this);

        }

Re: Example with CloseEditor event

Posted: Fri Oct 28, 2011 10:45 am
by 10050769
Hello TelventUser,

I not sure understand good what you refer when you talk about "right-clicks on chart and chooses Edit" and we would be very grateful if you can better explain as you want achieve.

On the other hand, I can not reproduce your problem, when you click with right button on the Chart. I have used next simple code:

Code: Select all

      Steema.TeeChart.Styles.Line line1;
      private void InitializeChart()
      {
          line1 = new Line(tChart2.Chart);
          line1.FillSampleValues();
          tChart2.Click += new EventHandler(tChart2_Click);
         
      }

      void tChart2_Click(object sender, EventArgs e)
      {
          Steema.TeeChart.Editor ed = new Steema.TeeChart.Editor();
          ed.Chart = tChart2;
          ed.CloseEditor += new EventHandler(ed_CloseEditor);
          ed.ShowModal(this);
      }

      void ed_CloseEditor(object sender, EventArgs e)
      {
          MessageBox.Show("in Refresh");
          return;
      }
Can you please,check if previous code works as you expected?

Thanks,