
Полный исходный код модуля
Код модуля программы Статистика представлен в листинге 3.1.
Листинг 3.1. Модуль программы Статистикаunit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
words: TLabel;
symbols: TLabel;
spaces: TLabel;
lines: TLabel;
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
Open1: TOpenDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ButtonlClick(Sender: TObject); begin
//начинаем обзор с текущей папки
Open1.InitialDir:= GetCurrentDir;
if Open1.Execute // открываем диалоговое окно выбора файла
then Edit1.Text:= Open1.FileName
else ShowMessage('Файл не выбран!');
end;
