esk
asked on
Inthe---> save all treeview in INI file
Hello Inthe, question for you
save all treeview in INI file and load it back
Esk
save all treeview in INI file and load it back
Esk
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yes, thanks
listening...
I have a much simpler way, granted it would need a little fine tuning for your specific case. But here goes:
unit helpered1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, IniFiles;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender : TObject);
var
I: integer;
Settings: TIniFile;
MyIniFile: string;
begin
MyIniFile := ExtractFilePath(Applicatio n.Exename) + 'output.ini';
Settings := TIniFile.Create(Myinifile) ;
for I := 0 to (TreeView1.Items.Count -1 ) do
Settings.WriteString(treev iew1.topit em.Text, IntToStr(i), TreeView1.Items.Item[I].Te xt);
end;
end.
unit helpered1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, IniFiles;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender
var
I: integer;
Settings: TIniFile;
MyIniFile: string;
begin
MyIniFile := ExtractFilePath(Applicatio
Settings := TIniFile.Create(Myinifile)
for I := 0 to (TreeView1.Items.Count -1 ) do
Settings.WriteString(treev
end;
end.
(the editbox isnt needed, I just added it for debugging and playing around with the code :) )
hi
but how to load a empty tree from ini file?
i had a few goes with no luck ;-(
but how to load a empty tree from ini file?
i had a few goes with no luck ;-(
ASKER
yeh, now is your turn again "gideon00"
Esk
Esk
ASKER
do you have any code "gideon00's" ?
but you rejected my answer *sniff*
ASKER
sorry, i give you the points if you can come with code that's load it back
Esk
Esk
SaveToFile saves a the tree view to the file specified in FileName.
procedure SaveToFile(const FileName: string);
Description
Use the SaveToFile method to store tree view data to a text file. The nodes can later be reloaded from the file into a new tree view object using the LoadFromFile method.
GL
mike