unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
ListBox1: TListBox;
Button1: TButton;
OpenDialog1: TOpenDialog;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
private
{ Private-Deklarationen }
FileList: TStringList;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FileList := TStringList.Create;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FileList.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Position: Integer;
begin
if OpenDialog1.Execute
then
begin
Position := FileList.Add(OpenDialog1.FileName);
ListBox1.Items.AddObject(ExtractFileName(OpenDialog1.FileName), TObject(Position));
end;
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
ShowMessage(FileList.Strings[ListBox1.ItemIndex]);
end;
end.