Page 1 of 1

TRichView 20.3 - LiveBindings

Posted: Fri Jun 03, 2022 10:13 am
by Sergey Tkachenko
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, LiveBinding 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.

Previous version:
https://www.trichview.com/forums/viewtopic.php?t=10743

LiveBindings in TRichView and ScaleRichView

Posted: Fri Jun 03, 2022 10:21 am
by Sergey Tkachenko
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:

TRichView-LiveBinding.png
TRichView-LiveBinding.png (19.66 KiB) Viewed 52920 times

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. The macOS screenshot is below:

Macosdb.png
Macosdb.png (58.99 KiB) Viewed 52918 times

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

Even 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

Posted: Fri Jun 03, 2022 10:42 am
by Sergey Tkachenko
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 LiveBinding as well:
OnNewDocument, OnLoadDocument, OnLoadCustomFormat, OnSaveCustomFormat.

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:

Code: Select all

RichViewDst.Document := RichViewSrc.Document;
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

Posted: Fri Jun 03, 2022 10:55 am
by Sergey Tkachenko
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.

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 contains 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.
AdapterBindSource.png
AdapterBindSource.png (16.26 KiB) Viewed 52898 times

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

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

PrototypeBindSource.png
PrototypeBindSource.png (22.42 KiB) Viewed 52897 times

Other changes

Posted: Fri Jun 03, 2022 11:26 am
by Sergey Tkachenko
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.

TRichView 20.3.1 - RichViewXML improvement

Posted: Fri Jul 01, 2022 3:15 pm
by Sergey Tkachenko
We've updated our TRichView setups to version 20.3.1.
These setups still contain TRichView 20.3.

This update includes a minor change in RichViewActions (datamodules with toolbar images were fixed for compatibilities with older version of Delphi) and major changes in RichViewXML component.

RichViewXML allows loading and saving TRichView document as XML files. They are like RVF (RichView Format) files, but human-readable.

Changes in RichViewXML:
  • options to save XML files without definitions of named styles (StyleTemplates), to allow using the same collection of named styles in multiple documents (StyleTemplates should be stored elsewhere).
  • detecting graphic type by content
  • option to ignore incorrect images (corrupted, missed files, unknown format, etc.), replacing non-background images with TRVStyle.InvalidPicture.
  • calling events on saving and loading external images (OnSaveImage2 and OnImportPicture)
  • option to ignore incorrect indexes of text, paragraph and list styles.
  • loading and saving properties that were added in recent TRichView updates
  • option to store images from TImageList as a pair of ImageList.Tag and ImageIndex (for bullets, hotspot, list levels) . On loading, OnRVFImageListNeeded event occurs. New property StoreImageLists (=False) activates this option. This way of saving is supported both in VCL/LCL and in FireMonkey versions
  • ability to exclude unnecessary properties (such as RVFOptions, RTFOptions, EditorOptions, Options) from saving and loading from XML. New property StoreProperties lists all these additional properties that are saved and loaded
  • some code clean up
Note: most of new features are controlled by TRichView properties designed for RVF (RichView Format).
In future, I plan to add an option to ignore almost all RichViewXML properties and using the same properties for RVF and XML formats.