[英]How Delphi object inspector grey some properties?
Recently I found that Delphi object inspector displays some properties in grey. 最近我发现Delphi对象检查器以灰色显示一些属性。 Here is an example:
这是一个例子:
I wonder what does it mean? 我想知道它是什么意思? How such properties are defined?
如何定义这些属性? I did not find any differences in definition of let's say DSHostname and ProxyHost .
我没有发现让我们说DSHostname和ProxyHost的定义有任何不同。 But as you can see DSHostname is displayed normally and ProxyHost in grey.
但正如您所见, DSHostname正常显示, ProxyHost显示为灰色。
Here is a relevant declaration of properties in question: 以下是相关财产的相关声明:
/// <summary>The host to proxy requests through, or empty string to not use a proxy.</summary>
property ProxyHost: string read FProxyHost write FProxyHost;
/// <summary>The port on the proxy host to proxy requests through. Ignored if DSProxyHost isn't set.
/// </summary>
[Default(8888)]
property ProxyPort: Integer read FProxyPort write FProxyPort default 8888;
/// <summary>The user name for authentication with the specified proxy.</summary>
property ProxyUsername: string read FProxyUsername write FProxyUsername;
/// <summary>The password for authentication with the specified proxy.</summary>
property ProxyPassword: string read FProxyPassword write FProxyPassword;
Finally I got a proof that Remy Lebeau was right in his guess. 最后,我得到了一个证据,证明Remy Lebeau的猜测正确。 I made a descendant of TDSClientCallbackChannelManager which has published property TestProxyHost .
我做了TDSClientCallbackChannelManager的后代,它已经发布了属性TestProxyHost 。 This property does nothing but mirroring ProxyHost in Get and Set.
此属性除了在Get和Set中镜像ProxyHost之外什么都不做。 Here is the full code for the component:
以下是组件的完整代码:
unit uTestCallbackChannelManager;
interface
uses
System.SysUtils, System.Classes, Datasnap.DSCommon;
type
TTestCallbackChannelManager = class(TDSClientCallbackChannelManager)
private
function GetTestProxyHost: string;
procedure SetTestProxyHost(const Value: string);
published
property TestProxyHost: string read GetTestProxyHost write SetTestProxyHost;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TTestCallbackChannelManager]);
end;
{ TTestCallbackChannelManager }
function TTestCallbackChannelManager.GetTestProxyHost: string;
begin
Result := ProxyHost;
end;
procedure TTestCallbackChannelManager.SetTestProxyHost(const Value: string);
begin
ProxyHost := Value;
end;
end.
After I installed TTestCallbackChannelManager into component palette I dropped in on a form in a test project. 在我将TTestCallbackChannelManager安装到组件面板后,我将其放入测试项目中的表单上。
In Object Inspector the ProxyHost property is displayed in grey and TestProxyHost as normal. 在Object Inspector中, ProxyHost属性显示为灰色, TestProxyHost正常显示。 Now if I change TestProxyHost then ProxyHost is changed as well.
现在,如果我更改TestProxyHost,那么也会更改ProxyHost 。 Here is a screenshot:
这是一个截图:
This means: 这意味着:
The only problem is what logic behind the Property Editor? 唯一的问题是属性编辑器背后的逻辑是什么? When the properties become available and how to use them?
当属性可用时以及如何使用它们? It looks like the properties are introduced very recently in xe10 or a bit earlier.
看起来这些属性最近在xe10或更早版本中引入。 And Embarcadero provides no documentation about these properties (at least for now I could not find any).
Embarcadero没有提供有关这些属性的文档(至少目前我找不到任何文档)。 But this is a subject of separate question.
但这是一个单独问题的主题。 I suspect that support for these properties has not been tested (or may be not implemented) yet and so they are intended for use in future releases.
我怀疑对这些属性的支持尚未经过测试(或可能尚未实现),因此它们旨在用于将来的版本中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.