在封装TFormPP=class(TForm)中 published 段写了新方法,但在实例中却看不到! ( 积分: 100 )

  • 主题发起人 主题发起人 LWH006
  • 开始时间 开始时间
L

LWH006

Unregistered / Unconfirmed
GUEST, unregistred user!
就是那个OnSetNewEnabled方法,在对象观察器中看不到的。
请帮忙看一下,万分感谢!

unit FormPP;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TFormPP = class(TForm)
private
FOnSetNewEnabled :TNotifyEvent;
public
{ Public declarations }
published
property OnSetNewEnabled :TNotifyEvent read FOnSetNewEnabled write FOnSetNewEnabled;
end;

var
FormPP: TFormPP;
implementation
{$R *.dfm}
end.
 
就是那个OnSetNewEnabled方法,在对象观察器中看不到的。
请帮忙看一下,万分感谢!

unit FormPP;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TFormPP = class(TForm)
private
FOnSetNewEnabled :TNotifyEvent;
public
{ Public declarations }
published
property OnSetNewEnabled :TNotifyEvent read FOnSetNewEnabled write FOnSetNewEnabled;
end;

var
FormPP: TFormPP;
implementation
{$R *.dfm}
end.
 
的确很奇怪,而且用File--New--Other...--Project1--FormPP继承下来的窗体在对象观察器中也看不到可在代码中却可以?
 
unit Unit2;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
ff:TFormPP;
begin
ff.Create();
ff.//我在此处它有提示喲
end;

end.
 
对象编辑器只看TForm的状态
应该注册一个有这样属性的组件,然后在工程中代替TForm
 
重载一下Create方法
我写控件没什么经验 但我看所有控件都有对Create方法重载
public
constructor Create(AOwner: TComponent); override;
 
这样是不行得,建立一个delphi专家然后安装才行
 
多人接受答案了。
 
后退
顶部