My little program can currently open a directory with DirectoryEdit, display its contents in a FileListBox and doubleclick a line to show the name in a showmessage.
All very basic.
I would like to be able to doubleclick the filename and open the file to display its contents in a memobox or similar for editing.
The file will only be .txt.
Can anyone offer any help ?
Thanks.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, ListFilterEdit, Forms, Controls, Graphics,
Dialogs, StdCtrls, EditBtn, FileCtrl;
type
{ TForm1 }
TForm1 = class(TForm)
DirectoryEdit1: TDirectoryEdit;
FileListBox1: TFileListBox;
Memo1: TMemo;
procedure DirectoryEdit1Change(Sender: TObject);
procedure FileListBox1DblClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.DirectoryEdit1Change(Sender: TObject);
begin
FileListBox1.Directory:=DirectoryEdit1.Directory;
end;
procedure TForm1.FileListBox1DblClick(Sender: TObject);
begin
showmessage(extractFileName(FileListbox1.filename));
end;
end.