FireMonkey database demo in macOS

TRichView 20.3 – LiveBindings

We’ve uploaded new versions of our components: TRichView 20.3, ScaleRichView 11.3, ReportWorkshop 4.1

Trial versions are available here: https://www.trichview.com/download/

The new feature of this update is LiveBindings support.
LiveBindings requires Delphi or C++Builder XE3 or newer (but some features can be used in Delphi or C++Builder XE2).
LiveBindings is not available in Lazarus.

FireMonkey does not include special data-aware components, so TDBRichView and TDBRichViewEdit components are VCL- and LCL-only.
However, LiveBindings can be used to link TRichView and TRichViewEdit components to a database field, both in VCL and FireMonkey frameworks.

More about LiveBindings on the Embarcadero web site: LiveBindings in RAD Studio.

LiveBindings in TRichView and ScaleRichView

A new property Document is added to TRichView, TRichViewEdit, and TSRichViewEdit components.
The main use of this property is linking a TRichView/ScaleRichView control to a database field of TBlobField type.

On the screenshot below, you can see how TRichViewEdit is linked to a blob field, and TEdit is linked to a text field:

This is a design-time screenshot of the new demo placed in TRichView\Demos\DelphiUnicode\DB Demos.FireDAC_IB\4 LiveBindings\
(or C++Builder version in TRichView\Demos\CBuilderUnicode\DB Demos.FireDAC_IB\4 LiveBindings\).
This is the analog of TRichView\Demos\DelphiUnicode\DB Demos.FireDAC_IB\1 DBRichViewEdit\, but it uses LiveBindings instead of a special data-aware component. This demo uses FireDAC and InterBase server.

A FireMonkey version of this demo is available as well, in TRichView\Demos\Delphi.FMX\DBDemos\DBLiveBindings.FireDAC_IB\. This demo uses FireDAC and InterBase server for Windows, and IBLite for macOS. A macOS screenshot is below:

This is the first DB-related TRichView FireMonkey demo, because FireMonkey requires LiveBindings for linking controls to database fields.

Event if you do not use TDBRichView and TDBRichViewEdit components, for linking TRichView and ScaleRichView to a database field, include DBRV (for VCL) or fmxDBRV (for FireMonkey) in your projects. This unit implements assignments between TRichView Document and TBlobField.

More about Document property

Sub-properties

Document property has sub-properties similar to the properties of data-aware components:

  • FieldFormat specifies the format for saving to a database field (RVF / RTF/ DocX / text). This property affects storing to DB. When loading from DB, the field format is auto-detected.
  • IgnoreEscape allows/disallows processing Escape key. By default, Escape resets editing (reloading the last saved data from the database field)
  • AutoDeleteUnusedStyles allows removing unused text, paragraph, and list styles before loading, to prevent documents growing in size unnecessarily.

Events

The events that were previously available in the data-aware components are now available in all controls, and occur on LiveBindings as well:
OnNewDocumentOnLoadDocumentOnLoadCustomFormatOnSaveCustomFormat.

Document assignment

Another use of Document property is copying documents between TRichView controls.
Previously, to copy content, you needed to create a memory stream, save the source TRichView to this stream as RVF, load the destination TRichView from this stream, format the destination TRichView, free the memory stream.
Now, you can simply write:

To-do

In future updates, we plan to allow editing this property at design-time and store documents in DFM/FMX files of the project.

LiveBindings in ReportWorkshop

New component

ReportWorkshop builds reports in TRichView or ScaleRichView controls (VCL-only).
It includes a set of “data provider” components that supply data for reports.
While “data providers” are not limited to data from databases, so far all available data provider components took data from various TDataSet components.
Implementing other sources of data required programming (see the demo how to get data for reports from TListView).

In this update, we included a new component:
Image TRVReportBindSourceDataProvider
(RAD Studio XE3 or newer is required)

This component provides data using LiveBindings from one ore more BindSource or BindSourceAdapter components.
Possible sources of data:

  • TDataGeneratorAdapter
  • TAdapterBindSource
  • TPrototypeBindSource

This data provider supports fields of the following types: all integer and floating point types, Boolean, TDate, TTime, TDateTime, String, TStrings, TGraphic (for VCL) or TBitmap (for FireMonkey).

In this version, TBindSourceDB cannot be used as a data source for TRVReportBindSourceDataProvider. But this is not a critical limitation, because you can always use another data provider component working directly with TDataSet.

New demo projects

ReportWorkshop\Demos\Delphi\LiveBindings\AdapterBindSource\: data from programmer-defined classes

This demo implements a class TEmployee that contain a name, a position, an age, a starting working date, and a “photo” of a person.
It creates a list of these objects and uses TAdapterBindSource to provide data from this list using LiveBindings. Then it uses TRVReportBindSourceDataProvider to get data from this TAdapterBindSource for a report.

ReportWorkshop\Demos\Delphi\LiveBindings\PrototypeBindSource\: randomly generated data

This demo builds a report from data randomly generated by TPrototypeBindSource component.

Other changes

User interface translation

Translation of RichViewActions and ScaleRichView to Romanian has been updated, thanks to Cosmin Ciuperca.
Not only new messages were translated, but old messages were reviewed and corrected.

PDF manuals

Documentations for our components are available:

  • as Windows help files (CHM) included in the components (and integrated in new versions of RAD Studio IDE by our setup)
  • as online manual
  • as PDF manuals; they are included in the full versions of our components or can be downloaded separately

In this update, PDF manuals were re-worked. All problems with layouts were fixed, and special printer-friendly styles were applied.
PS: we use Help+Manual to create documentations for our products (a great application that uses TRichView for editing help topics). Special thanks to Alexander Halser for helping me with preparing this update of PDF manuals.

Share this article