New LiveBinding

From RAD Studio
Jump to: navigation, search

Go Up to LiveBindings Dialog Boxes


The New LiveBinding dialog box appears when you attempt to create a new LiveBinding in your application from within the bindings list editor. In the New LiveBinding dialog box, you are prompted to select a binding class for your new LiveBinding.

Binding Classes

The available binding classes, as exposed by the New LiveBinding dialog box, are:

  • Quick Bindings
    • TLinkGridToDataSource links a grid to a data source.
    • TLinkListControlToField links a list to a field in a data source. It is used to fill a list with the field values from a data source and navigate the data source using the list control. As the data source is edited, the control is automatically updated.
    • TLinkControlToField links a control to a field in a data source. When the control is modified by user input, the field is updated. When the field changes, the control is updated.
    • TLinkControlToProperty links a control to a property. When the control is modified by user input, the component property is updated.
    • TLinkPropertyToField links a property to a field in a data source. When the field is edited or the data source scrolled, the component property is updated.
    • TLinkFillControlToField is like TLinkControlToField, but when used with a list control, it can populate the list with values from another data source.
    • TLinkFillControlToProperty is like TLinkControlToProperty, but when used with a list control, it can populate the list with values from a data source.
  • Binding Expressions
  • Links
    • TBindLink is used to support two-way editing between a control and a field in a datasource--executing binding expressions when the value of a control changes and when the value of the field changes.
    • TBindListLink is used to allow a list control to show the values from a data source, navigate the data source, and keep up to date when the data source is edited.
    • TBindGridLink is used to allow a grid control to show the values from a data source, navigate the data source, and keep up to date when the data source is edited. Also used to update the data source when a cell in the grid is edited.
    • TBindPosition is used to allow a positional control such as a scroll bar to scroll a data source.
    • TBindControlValue executes binding expressions when the value of a control is changed.
  • Lists
    • TBindList is used to fill a list control from a data source.
    • TBindGridList is similar to TBindList, but works on grids. It is used to fill a grid control from a data source.
  • DB Links (deprecated)
    • TBindDBEditLink is used to link an edit box to an editable text field in a data source.
    • TBindDBTextLink is used to link a label to a text field in a data source.
    • TBindDBListLink is used to link a list to a field in a data source.
    • TBindDBImageLink is used to link an image control to a graphical field in a data source.
    • TBindDBMemoLink is used to link a memo control to a multiline text field in a data source.
    • TBindDBCheckLink is used to link a check-box control to a Boolean field in a data source.
    • TBindDBGridLink is used to link a grid control to a data source.

LBNewLiveBinding.png

To validate your selection, click the OK button.

At this point, your new LiveBinding should appear in the Object Inspector as well as in the bindings list that is present on your form.

Quick Binding Components Reference

This section covers some aspects related to the quick binding components, in other terms, is a quick reference guide. The difference between the quick binding components and the other binding components like TBindLink, TBindList, and so on, is that the quick binding components automatically generate expressions, while the other components require manual editing of expressions. So in the expression editor for a quick binding component, you can view the expressions that are generated, but you cannot edit them.

Delegates

Each of the quick binding components delegates to another LiveBindings component. The delegate is responsible for executing expressions and monitoring the user input. The quick binding components are responsible for generating the correct expression strings into the delegate component.

The delegates are as follows:

Bind Source Components

Bind source components such as TBindSourceDB are used when binding to fields. For instance, TLinkPropertyToField, TLinkListControlToField, and TLinkControlToField all have a reference to a scope component. They also have a field name property, which is selected from a field list provided by the scope component.

For instance, in the following image, a TLinkPropertyToField component references a TBindSourceDB called BindScopeDB1, and a field--Species Name.

LBPropertyToField.png

TBindScope cannot be used with any quick binding components but the following components work:

The data source must derive from TBaseLinkingBindSource.

Expression Generation

In order for the quick binding components to generate the correct expressions, they must collect information about the members of the components being bound. For instance, when binding to a control, they must know the property of the control that is changed when the control is modified by user input. When binding to a field, they must know the name of the field property or method to access the value of the field.

The scope components provide an interface for getting the member name of a field.

Expression Editor

The expression editor can be used to view expressions, but they are all read-only. The component must be active in order for expressions to be generated and viewed.

LBPropertyToFieldExpEdt.png

See Also