unit MemoForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TfrmMemo = class(TForm)
    lbPrompt: TLabel;
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Function InputMemo(ACaption,APrompt:String; var Value:String):Boolean;
  end;

var
  frmMemo: TfrmMemo;

implementation

{$R *.dfm}

{ TfrmMemo }

function TfrmMemo.InputMemo(ACaption, APrompt: String;
  var Value: String): Boolean;
begin
  Result := False;
  Caption := aCaption;
  lbPrompt.Caption := aPrompt;
  Memo1.Text := Value;
  ShowModal;
  if ModalResult = mrOk then begin
    Result := True;
    Value := Memo1.Lines.Text;
  end;
end;

procedure TfrmMemo.Button1Click(Sender: TObject);
begin
  ModalResult := mrOk;
  Hide;
end;

procedure TfrmMemo.Button2Click(Sender: TObject);
begin
  ModalResult := mrCancel;
  Hide;
end;

end.
