1

To get started with live bindings i am currently writing some demo code. But at one point i have a problem where i don't find any documentation on.

I have a form with multiple TEdit's and want to bind them with an TBindScope to properties of an object. I setup the BindScope and the BindingList and everything works for the moment when i do BindExpression1.Active := true;

But now i change the properties of the object and want to notify the BindingList about an update.

Here is the Problem. I cant find any way to notify the BindingList, so it updates the values. But if i do a BindExpression1.Evaluate it synchronises the values.

I tried using

  • BindingList.Notify(BindScope, 'Object.Property')
  • BindingList.Notify(BindScope, 'Object')
  • BindingList.Notify(Object, 'Property');
  • BindingList.Notify(BindScope, 'Property');
  • BindingList.Notify(BindScope, 'Active');

Nothing seems to work for the notification.

P.S. : I know that in this case the BindScope is not necessarely needed. But since its demo code for understanding, i would like to know how it works with the BindScope.

Thanks.

Marks
  • 3,613
  • 5
  • 31
  • 46

1 Answers1

0

See the source code of TCustomBindScope.GetValue for details on how the scope is resolved.

  1. Component is used if assigned, otherwise
  2. DataObject is used if assigned, otherwise
  3. Owner is used

So the simplest solution is probably to leave the Component property (of your TBindScope component) unassigned and make your Object a property of the owner form.

Ondrej Kelle
  • 36,941
  • 2
  • 65
  • 128
  • I think that the problem I described is not caused by a problem in resolving the BindScope. Because else i think the BindExpression1.Evaluate would not work. The question is more how do i have to notify when the value changed. – Marks Jul 25 '12 at 09:35
  • @Marks That sounds right, try to post the complete compilable code to reproduce the problem. – Ondrej Kelle Jul 25 '12 at 09:41