Creating the Application and Defining the Uses Clause
- Caution: The programmatic method described here is NOT the standard way to implement binding expressions. Typically, you would use the Object Inspector (the standard method) at design time. You might never need to use the programmatic way of creating binding expressions. This tutorial demonstrates, however, that it is possible to manually create such expressions.
- For examples of using LiveBindings in the standard way, see:
To better exemplify how to use LiveBinding programmatically, create a new project by choosing:
- File > New > Other > Delphi Projects > Console Application (Delphi Console Application)
- File > New > Other > C++Builder Projects > Console Application (C++Builder Console Application)
If you choose to build a C++Builder console application, then, from the New Console Application (C++) wizard, choose Source Type as C++, Target Framework as none, deselect Multi Threaded, and make sure Console Application is selected.
For a Delphi project, you must include the following units in the Uses clause:
Uses System.Bindings.Expression, System.Bindings.Helper;
For a C++Builder project, you must include the following headers:
#include <System.Bindings.Expression.hpp> #include <System.Bindings.Helper.hpp>
You also have to instruct the C++ compiler to generate RTTI information used by the LiveBindings engine. To do this, add the following line at the beginning of your project.
#pragma explicit_rtti methods()
For more information on these units, please consult the appropriate API reference topics:
- System.Bindings.Expression (for binding expression-related classes and routines)
- System.Bindings.Helper (for binding helper class with utility methods)