R
rove11
Unregistered / Unconfirmed
GUEST, unregistred user!
《D5开发人员指南》 21章 21-16
把窗体做为对话框的形式,加上组件外套,作为组件安装。
代码如下:
unit pwdlg2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tpassworddlg = class(TForm)
password: TEdit;
Label1: TLabel;
okbtn: TButton;
cancelbtn: TButton;
end;
tddpassworddlg=class(tcontrol)
private
passworddlg:tpassworddlg;
fpassword:string;
public
function execute:boolean;
published
property passwor:string read fpassword write fpassword;
end;
procedure register;
implementation
{$R *.dfm}
{ tddpassworddlg }
function tddpassworddlg.execute: boolean;
begin
passworddlg:=tpassworddlg.create(application);
try
result:=false;
if passworddlg.showmodal=mrok then
result:=passworddlg.password.text=fpassword;
finally
passworddlg.free;
end;
end;
procedure register;
begin
registercomponents('samples',[tddpassworddlg]);
end;
end.
把窗体做为对话框的形式,加上组件外套,作为组件安装。
代码如下:
unit pwdlg2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tpassworddlg = class(TForm)
password: TEdit;
Label1: TLabel;
okbtn: TButton;
cancelbtn: TButton;
end;
tddpassworddlg=class(tcontrol)
private
passworddlg:tpassworddlg;
fpassword:string;
public
function execute:boolean;
published
property passwor:string read fpassword write fpassword;
end;
procedure register;
implementation
{$R *.dfm}
{ tddpassworddlg }
function tddpassworddlg.execute: boolean;
begin
passworddlg:=tpassworddlg.create(application);
try
result:=false;
if passworddlg.showmodal=mrok then
result:=passworddlg.password.text=fpassword;
finally
passworddlg.free;
end;
end;
procedure register;
begin
registercomponents('samples',[tddpassworddlg]);
end;
end.