简体   繁体   English

Delphi LiveBindings:将组件属性绑定到TEdit

[英]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 tag that show how it's done. 我对LiveBindings系统不是特别熟悉,但是标记中有几个问题可以说明它是如何完成的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TEdit属性变量delphi - TEdit property variable delphi Delphi 使用 LiveBindings 时无法更改此属性 - Delphi Cannot change this property when using LiveBindings Delphi LiveBindings TPrototypeBindSource和customFormat - Delphi LiveBindings TPrototypeBindSource and customFormat Delphi:Livebindings AfterScroll on TListView - Delphi : Livebindings AfterScroll on TListView 我可以仅将Delphi TEdit(或类似版本)连接到类的已发布属性吗? - Can I connect a Delphi TEdit (or similar) simply to a published property of a class? 通过在 Delphi VCL 中组合两个控件(TEdit 和 TTrackBar)来创建一个新组件 - Creating a new component by combining two controls (TEdit and TTrackBar) in Delphi VCL 如何在delphi中动态创建组件,如TLabel或TEdit等 - how to dynamically create a component in delphi such as TLabel or TEdit …etc 在TEdit.onEnter事件中设置TEdit.PasswordChar属性会导致TEdit无法在Delphi XE西雅图显示选择和光标 - set TEdit.PasswordChar property in TEdit.onEnter event causes TEdit can not show selection and cursor in Delphi XE seattle 自定义组件属性LiveBindings - Custom component properties LiveBindings Delphi无边界或扁平tEdit - Delphi borderless or flat tEdit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM