home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 December
/
Chip_2001-12_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
DM2KVCL.ZIP
/
TEXTDLG.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
2001-09-04
|
2KB
|
62 lines
{****************************************************************************}
{ Data Master 2000 }
{****************************************************************************}
unit TextDlg;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ComCtrls;
type
TTextForm = class(TForm)
Memo: TMemo;
OkBitBtn: TBitBtn;
CancelBitBtn: TBitBtn;
private
{ Private declarations }
public
{ Public declarations }
procedure CreateParams(var Params: TCreateParams); override;
end;
function InputText(var S: string; Ed: TControl=nil): boolean;
implementation
{$R *.DFM}
var TextForm: TTextForm;
function InputText(var S: string; Ed: TControl): boolean;
var I: integer; P: TPoint;
begin
TextForm:=TTextForm.Create(Application);
try
TextForm.Memo.Text:=S;
if Assigned(Ed) then
begin
P:=Ed.ClientToScreen(Point(0,0));
TextForm.Top:=P.Y+Ed.Height; TextForm.Left:=P.X;
TextForm.Width:=Ed.Width+TextForm.Width-TextForm.Memo.Width;
end;
Result:=TextForm.ShowModal=mrOk;
if Result then
begin
S:='';
for I:=0 to TextForm.Memo.Lines.Count-1 do
S:=S+TextForm.Memo.Lines[I];
end;
finally
TextForm.Free;
end;
end;
{ TTextForm }
procedure TTextForm.CreateParams(var Params: TCreateParams);
begin inherited; Params.Style:=WS_POPUP or WS_THICKFRAME end;
end.