52 lines
747 B
ObjectPascal
52 lines
747 B
ObjectPascal
unit unitmain;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, person;
|
|
|
|
type
|
|
|
|
{ TMainform }
|
|
TMainform = class(TForm)
|
|
rgPeople: TRadioGroup;
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure rgPeopleClick(Sender: TObject);
|
|
end;
|
|
|
|
var
|
|
Form1: TMainform;
|
|
|
|
implementation
|
|
|
|
{$R mainform.lfm}
|
|
|
|
{ TMainform }
|
|
|
|
procedure TMainform.FormCreate(Sender: TObject);
|
|
begin
|
|
|
|
end;
|
|
|
|
procedure TMainform.rgPeopleClick(Sender: TObject);
|
|
var p: TPerson;
|
|
begin
|
|
if rgPeople.ItemIndex < 0 then Exit;
|
|
|
|
// Select the appropriate Person
|
|
case rgPeople.ItemIndex of
|
|
0: p := TBeckham.Create;
|
|
1: p := TShakespeare.Create;
|
|
2: p := TWest.Create;
|
|
3: p := TBlaise.Create;
|
|
end;
|
|
|
|
p.Speak;
|
|
p.Free;
|
|
end;
|
|
|
|
end.
|
|
|