Tutorial: Linking Controls via LiveBindings Designer
Go Up to Database and LiveBindings Tutorials
This tutorial shows how to use the LiveBindings Designer to visually create LiveBindings between controls in order to create applications that require little or no source code.
In this tutorial, you create an HD Multi-Device Application that uses LiveBindings to bind several objects in order to change the stroke and fill colors of a circle. All the bindings are seamlessly created in a visual manner using the LiveBindings Designer.
Step 1: Creating the Project
Create a new project. Choose an HD Multi-Device Application for this example.
- Drag and drop a TCircle component onto the Form Designer.
- In the Tool Palette, locate a TColorPanel component and drop it onto the form.
- Do the same for a TComboColorBox control.
After placing the components on the form, it should look as in the following picture.
Step 2: Creating the LiveBindings
Your diagram contains individual blocks that represent objects on your form. At this point, they are not linked to each other. Locate the block that represents the circle (Circle1) and click the 3 dots in the lower-right corner.
- Select the
Stroke.Colorproperties from the Bindable Members dialog box.
After you press OK, the Circle1 component is drawn with the two exposed properties.
- Click the
Colorproperty of the ComboColorBox1 block and drag a line to the
Stroke.Colorproperty of the Circle1 block.
- Click the
Colorproperty of the ColorPanel1 block and drag a line to the
Fill.Colorproperty of the Circle1 block.
- Press the Rearrange button () in order to auto-arrange the diagram, or you can arrange the blocks yourself.
At this point, your bindings diagram should look as pictured below.
Run the Application by pressing F9 or using the Run > Run menu command. Change the colors and observe the results.