Page 1 of 1

Saving and Loading Chart from file problems (Please help)

Posted: Tue Jul 11, 2006 11:39 am
by 9346270
Hi.

I am having a problem Saving and Loading charts from file.
Here are the 2 procedures:

procedure TfrMain.GraphSaveClick(Sender: TObject);
begin
GraphName := PopupMenuGraph.PopupComponent.Name;
frSave.Show;
end;

procedure TfrMain.GraphOpenClick(Sender: TObject);
var tmpChart:TCustomChart;
File_name: String;
begin
GraphName := PopupMenuGraph.PopupComponent.Name;
For Search := 1 to 40 do
Begin
If GraphName = Graph[Search].Name then
Begin
Found := Search;
Break;
end;
end;
frOpen.Showmodal;
Graph[Found].Free;
tmpChart:=TChart.Create(Self);
File_name := saveUnit.File_name + '.tee';
LoadChartfromFile(tmpChart,File_name);
Graph[Found] := tmpChart as TChart;
Graph[Found].Parent := Page1;
end;

And the other 2:

procedure TfrOpen.btnAcceptClick(Sender: TObject);
begin
File_name := Filelistbox1.Directory + '\' + Filenameedit.Text;
File_name2 := Filelistbox1.Directory + '\';
frOpen.Close;
Closed := false;
end;

procedure TfrSave.btnAcceptClick(Sender: TObject);
var Search, Found: integer;
begin
File_name := Filelistbox1.Directory + '\' + Filenameedit.Text;
File_name2 := Filelistbox1.Directory + '\';
For Search := 1 to 40 do
Begin
If GraphName = Graph[Search].Name then
Begin
Found := Search;
Break;
end;
end;
SaveChartToFile(Graph[Found],File_name,True);
frSave.Close;
Closed := false;
end;

Hope it makes sense. Ask if it doesnt. It doesnt work though. And ive tried everything. :/

Thanks in advance.

Regards
Justin aka thr4sh3r

Posted: Tue Jul 11, 2006 11:50 am
by narcis
Hi Justin,

Which are the exact problems you are having? Maybe reading this other thread may help you solving them, specially including TeeEditPro unit.

Posted: Tue Jul 11, 2006 12:22 pm
by 9346270
Thank you NarcĂ­s.

That was so simple, why wasnt it included in the Help/Manual?
Would of saved me a lot of time.

Works perfectly now. :)

Posted: Tue Jul 11, 2006 12:52 pm
by narcis
Hi Justin,

You're welcome. I'm glad to hear that solved your issue.

BTW: This is already included in the features demo examples :wink: .