Search code examples
delphilivebindings

Delphi LiveBindings: binding a component property to a TEdit


In want to use LiveBindings in Delphi XE5. I am new to this.

I have a VCL TForm with a TEdit.

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.

I tried this with right clicking on the TEdit and select "Bind visually" as well as with the LiveBindings wizard. The problem is that the MyComponent is not listed in the components list there.

The unit which contains MyComponent is in the uses clause of the form.

What am I doing wrong?

Thanks!


Solution

  • The IDE only knows about component classes that have been registered with it. 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.