Example with CloseEditor event

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Example with CloseEditor event

Post by TelventUser » Wed Oct 26, 2011 10:50 pm

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.

TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Re: Example with CloseEditor event

Post by TelventUser » Thu Oct 27, 2011 2:36 pm

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);

        }

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Example with CloseEditor event

Post by Sandra » Fri Oct 28, 2011 10:45 am

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,
Best Regards,
Sandra Pazos / 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