[英]Delphi LiveBindings: binding a component property to a TEdit
In want to use LiveBindings in Delphi XE5. 要在Delphi XE5中使用LiveBindings。 I am new to this.
我是新来的。
I have a VCL TForm with a TEdit. 我有一个带有TEdit的VCL TForm。
I have a component in a seperate unit: 我在一个单独的单元中有一个组件:
TMyComponent=class(TComponent)
private
FMyProperty: Integer;
public
property MyProperty: Integer read FMyProperty write FMyProperty;
end;
Now I want to bind MyProperty to the TEdit. 现在,我想将MyProperty绑定到TEdit。
I tried this with right clicking on the TEdit and select "Bind visually" as well as with the LiveBindings wizard. 我通过右键单击TEdit并选择“可视绑定”以及LiveBindings向导来尝试此操作。 The problem is that the MyComponent is not listed in the components list there.
问题在于MyComponent没有在组件列表中列出。
The unit which contains MyComponent is in the uses clause of the form. 包含MyComponent的单元位于表单的uses子句中。
What am I doing wrong? 我究竟做错了什么?
Thanks! 谢谢!
The IDE only knows about component classes that have been registered with it. IDE仅知道已向其注册的组件类。 To make this work at design-time, you need to build a package that registers the component class.
为了在设计时进行此工作,您需要构建一个注册组件类的包。 Otherwise, you'll need to create the bindings programmatically.
否则,您将需要以编程方式创建绑定。 I'm not particularly familiar with the LiveBindings system, but there are several questions in the livebindings tag that show how it's done.
我对LiveBindings系统不是特别熟悉,但是livebindings标记中有几个问题可以说明它是如何完成的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.