未在对象检查器中显示已发布的属性 [英] published property not shown in Object Inspector

查看:130
本文介绍了未在对象检查器中显示已发布的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的环境:Windows 7 Pro(32位)上的RadStudio XE4。

My environment: RadStudio XE4 on Windows 7 Pro (32bit).

Difference between property and function or procedures

在上面的问与答中,有一个答复说
更具体地说,如果使用Delphi IDE进行编程,您将看到已发布的属性(-y + ies)将显示在对象检查器中。

In the above Q and A, there is a reply saying "More concretely, if you use the Delphi IDE to program, you will see that the published property (-y+ies) will show up in the 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的 Property选项卡中有 SampleProp1。但是我没有那个。

I expected that I would have "SampleProp1" in the "property" tab of the Object Inspector. But I do not have that one.

相反,我在[Delphi Class Exploroer]窗口中有 SampleProp1。

Instead, I had the "SampleProp1" in the [Delphi Class Exploroer]" windows.

在对象检查器中拥有已发布的属性是否不正确?

Is it incorrect that I would have the published property in the Object Inspector?

推荐答案

对象检查器显示

因此,您可以将表单包含在设计时包中,并通过以下方式进行注册:调用 RegisterCustomModule 。但是,如果您的表单正在应用程序中进行积极的开发,这可能会很不方便,您可能会发现自己反复地在设计时程和

So you could include your form in a design time package and register it with a call to RegisterCustomModule. However this could be quite inconvenient if your form is under active development in your application. You might find yourself repeatedly getting out of sync between the design time package and the application.

另一种应用表单范围行为更改的方法是创建一个非可视组件,您可以将其放到表单上。这种方法的优点是您可以根据自己的喜好更改表格,而不会与y不同步我们的设计时组件。

Another way to apply form wide behaviour changes is to create a non-visual component that you can drop on to your form. The advantage of this approach is that you can change the form to your heart's content and not get out of sync with your design time components.

这篇关于未在对象检查器中显示已发布的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆