type
TForm1 = class(TForm)
ListBox1: TListBox;
ListBox2: TListBox;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure ListBox2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
with TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini')) do
try
ReadSections(ListBox1.Items);
finally
Free;
end;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var
sSection: String;
begin
if ListBox1.ItemIndex < 0 then Exit;
sSection := ListBox1.Items.Strings[ListBox1.ItemIndex];
ListBox2.Items.Clear;
with TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini')) do
try
ReadSection(sSection, ListBox2.Items);
finally
Free;
end;
end;
procedure TForm1.ListBox2Click(Sender: TObject);
var
sSection, sIdent: String;
begin
if ListBox1.ItemIndex < 0 then Exit;
if ListBox2.ItemIndex < 0 then Exit;
sSection := ListBox1.Items.Strings[ListBox1.ItemIndex];
sIdent := ListBox2.Items.Strings[ListBox2.ItemIndex];
with TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini')) do
try
Edit1.Text := ReadString(sSection, sIdent, 'Error');
finally
Free;
end;
end;