Delphi RTL (Runtime Library) contains a mighty expression engine, one of the foundations of the LiveBindings architecture but can be utilized as a separate engine for processing expressions. It’s this kind of low-code super-charged feature which makes you really appreciate the powerful performance boost that having decent IDE software can add to your coding experience.
The LiveBindings for VCL and FireMonkey Delphi and C++ apps were introduced in RAD Studio XE2. It dramatically improved over the years as the technology matured by offering a progression of increasingly powerful features. The LiveBindings Designer lets you visually create and edit LiveBindings. The LiveBindings Wizard takes you through the steps to develop new LiveBindings expressions and make connections between existing and new components. The PrototypeBindSource provides a data source for generating sample data that you can use to get started when you do not already have data, to begin with, so later you can replace it with a natural data source.
Table of Contents
What is the Expression Engine?
The Expression engine takes string expressions and evaluates them to a value. That value might be a string, an integer, a boolean value, an object, or something else.
String expressions consist of four parts:
Methods further divided into method pointers and custom methods.
There are also output converters. The output converters take the expression evaluated by the expressions engine and assign it to a property of a different type.
What are Scopes in the Expression Engine?
Another thing is Scope – Scope is an essential concept in expressions with LiveBindings. Scope defines the object or objects that are visible to the expression engine. When an object is in scope, its properties and methods are available in the string expressions.
There is always at least one scope, but there are often two. One is associated with the control component, and the other is related to the source component. Quite often, the control component is known as the output scope. It is the target or the expression engine. In other words, the value of the expression created by the engine is assigned to a property of the component in the output scope or control component.
The source component is often visible to the expression engine in the input expression. The input expression whose value will be assigned to the property of the control and the output expression.
The direction can be bi-directional, like from Control Component to Source Component or Source Component to Control Component.
Learn more about here on documentation:
- Using LiveBindings to Create an Application Without Code
- Programatically Binding Created Objects
- Using Delphi’s Expressions Engine
Is the future of data access really through data bindings?
If you have been following our articles and webinars, you know the price of LiveBindings designer. For instance, you can easily connect to any third-party REST API and show the needed data on the target control without writing code. Even more, you can make interactive and dynamic actions using LiveBindings.
This tutorial will show how to utilize the TControlList component with LiveBindings. The demo app is demonstrated by Alister Christie, one of the best-known Embarcadero Delphi MVPs.
Below is a view of a relatively new visual component called TControlList. TControlList visual component is introduced in RAD Studio 10.4.2 version – it is a virtualized list control.
This new control allows the developer to define the contents by designing one of the elements of the list using graphical controls and providing data to the control to display individual elements, without creating all of the control for all of the elements in the list, but only those needed to display the data. This single row definition is then used as a template for subsequent rows.
Perhaps the best thing about it is that it can handle millions of items and offers fast, smooth, and responsive scrolling.
LiveBindings are more powerful than they appear
LiveBindings is more than just simple pointing data to target control. It has superpowers like linking controls to classes and internal code data structures.
Moreover, you can create your custom expressions in the LiveBindings editor.
Demonstration – TControlList with LiveBindings
This tutorial shows you how to use the new Delphi and C++ TControlList visual component as well as introducing some tips and tricks to make a responsive and smooth user experience while using LiveBindings to display various information by binding source and control.