Page 1 of 1
Chart Edit Native/Save event
Posted: Mon Mar 01, 2010 9:20 am
by 15655322
Hi,
I need to be able to programmatically pick-up the name of the .ten format file created through the Native/Save tab/button in the Chart Editor. That is, I want to use the Native/Save existing feature but to be able in my code (where I create and launch the Editor instance) to handle the saved file name.
Also, in case the user forgets to save his work in Editor, I want to be able to propose to save it during the "CloseForm" button event. I've tested the access to this event, that works, but what is the method to execute for saving in native (.ten) format programmatically?
Thanks!
Re: Chart Edit Native/Save event
Posted: Wed Mar 03, 2010 10:52 am
by 10050769
Hello Gabriel,
I need to be able to programmatically pick-up the name of the .ten format file created through the Native/Save tab/button in the Chart Editor. That is, I want to use the Native/Save existing feature but to be able in my code (where I create and launch the Editor instance) to handle the saved file name.
I am sorry, but actually is not possible pick-up the name of files using Chart Editor with last version of TeeChart.Net. I have added your suggestion in wish-list with number [
TF02014701] to be considered for inclusion in future releases.
Also, I recommend that use
SaveFileDialog for save file name. You could use a similar code as next:
Code: Select all
string nameChart;
private void InitializeChart()
{
Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar.FillSampleValues();
}
private void button1_Click(object sender, EventArgs e)
{
saveFileDialog1.Filter = "TenFile (.ten)|*.ten";
saveFileDialog1.ShowDialog();
if (saveFileDialog1.FileName != "")
{
tChart1.Export.Template.IncludeData = true;
tChart1.Export.Template.Save(saveFileDialog1.FileName);
nameChart = saveFileDialog1.FileName;
}
}
Also, in case the user forgets to save his work in Editor, I want to be able to propose to save it during the "CloseForm" button event. I've tested the access to this event, that works, but what is the method to execute for saving in native (.ten) format programmatically?
Please, see TeeChart .Net Pro Tutorials
Tutorial12 - Exporting and Importing Charts concretely TeeChart's 'Ten' template and data export/import format .
I hope will helps.
Thanks,
Re: Chart Edit Native/Save event
Posted: Wed Mar 03, 2010 11:44 am
by 15655322
Thanks Sandra.
As I said in my initial post, the way around is that I've coded a mandatory SaveFileDialog in the Close_Editor event. But I thought it would be good that you guys take into account of exposing an event for that button that you already have.
Also, I've spotted that if I try to export the created chart in .ten format (it is proposed on the list), but with an image-type file format highlighted (thus selected) on the textbox, I get a .net error window. This is normal, but:
- think about removing from the SaveFileDialog filter the .ten type in this case.
- better, implement in your code a try/catch rather than leaving the .net exception window to pop-up.
Re: Chart Edit Native/Save event
Posted: Fri Mar 05, 2010 2:59 pm
by yeray
Hi Gabriel,
Gabriel wrote:Also, I've spotted that if I try to export the created chart in .ten format (it is proposed on the list), but with an image-type file format highlighted (thus selected) on the textbox, I get a .net error window. This is normal, but:
- think about removing from the SaveFileDialog filter the .ten type in this case.
- better, implement in your code a try/catch rather than leaving the .net exception window to pop-up.
I've added it to the wish list to be enhanced for future releases (TF02014714).