蛤
蛤蟆跳井,不懂不懂
Unregistered / Unconfirmed
GUEST, unregistred user!
下面是《Delphi 5 基础与提高》中421页的例题。是以TCustomEdit为基类创建一个编辑型的时间显示组件,
并为其添加一个Boolean型的UsesysTime属性用于表示是否显示系统时间,添加一个鼠标右击事件。
可我按书上打好原码后编译组件时总是在“*********************************”的下面那一行处出错,
麻烦高手指点我这是为什么?
问题很菜,不要见笑!
unit TimeBox;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TTimeBox = class(TCustomEdit)
private
{ Private declarations }
fUseSysTime:Boolean;
procedure SetUseSysTime(value:Boolean);
//****************************************(下面这一行错在何处?)
fNotifyEvent:tNotifyEvent; //与鼠标右击事件相联系的变量
protected
{ Protected declarations }
public
{ Public declarations }
procedure RButtonDown(var Message:TMessage);message wm_RButtonDown;
constructor create(AOwner:tcomponent);override;
published
{ Published declarations }
property UseSysTime:Boolean //属性:是否显示系统时间
read fUseSysTime write SetUseSysTime default true;
//鼠标右击事件
property OnRButton:TNotifyEvent read fNotifyEvent write fNotifyEvent;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TTimeBox]);
end;
procedure TTimeBox.SetUseSysTime(value:boolean);
begin
if fUseSysTime<>value then
fUseSysTime:=value;
end;
procedure TTimeBox.RButtonDown(var Message:TMessage);
begin
if assigned(OnRButton)then
OnRButton(self);
end;
constructor TTimeBox.create(AOwner:TComponent);
begin
inherited create(AOwner);
fUseSysTime:=true;
Text:=datetostr(now)
end;
end.
并为其添加一个Boolean型的UsesysTime属性用于表示是否显示系统时间,添加一个鼠标右击事件。
可我按书上打好原码后编译组件时总是在“*********************************”的下面那一行处出错,
麻烦高手指点我这是为什么?
问题很菜,不要见笑!
unit TimeBox;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TTimeBox = class(TCustomEdit)
private
{ Private declarations }
fUseSysTime:Boolean;
procedure SetUseSysTime(value:Boolean);
//****************************************(下面这一行错在何处?)
fNotifyEvent:tNotifyEvent; //与鼠标右击事件相联系的变量
protected
{ Protected declarations }
public
{ Public declarations }
procedure RButtonDown(var Message:TMessage);message wm_RButtonDown;
constructor create(AOwner:tcomponent);override;
published
{ Published declarations }
property UseSysTime:Boolean //属性:是否显示系统时间
read fUseSysTime write SetUseSysTime default true;
//鼠标右击事件
property OnRButton:TNotifyEvent read fNotifyEvent write fNotifyEvent;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TTimeBox]);
end;
procedure TTimeBox.SetUseSysTime(value:boolean);
begin
if fUseSysTime<>value then
fUseSysTime:=value;
end;
procedure TTimeBox.RButtonDown(var Message:TMessage);
begin
if assigned(OnRButton)then
OnRButton(self);
end;
constructor TTimeBox.create(AOwner:TComponent);
begin
inherited create(AOwner);
fUseSysTime:=true;
Text:=datetostr(now)
end;
end.