【发布时间】:2014-07-16 21:15:15
【问题描述】:
我的环境:Windows 7 Pro(32 位)上的 RadStudio XE4。
Difference between property and function or procedures
在上面的Q和A中,有一个回复说 “更具体地说,如果您使用 Delphi IDE 进行编程,您将看到已发布的属性 (-y+ies) 将显示在 Object Inspector 中”。
我试过了。
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
TForm1 = class(TForm)
private
FSampleProp1: Integer;
function GetSampleProp1(): Integer;
procedure SetSampleProp1(val: Integer);
{ Private declaration }
published
{ Private declaration }
property SampleProp1: Integer read GetSampleProp1 write SetSampleProp1;
end;
我希望在 Object Inspector 的“属性”选项卡中有“SampleProp1”。但我没有那个。
相反,我在 [Delphi Class Exploroer] 窗口中有“SampleProp1”。
我在对象检查器中拥有已发布的属性是不正确的吗?
【问题讨论】:
-
这仅适用于您自己设计组件并将该组件安装到 IDE 中的情况。仅向表单添加属性无济于事...
-
非常感谢您的回复。所以对于自制组件,我可以在 Object Inspector 中看到属性。
-
@bummi:这应该作为答案发布。
-
@bummin:谢谢你的文章。
标签: delphi