Knowledge Base Alert April, 2017

TMS TAdvRichEditor:

Accepting only plain text for clipboard paste with TAdvRichEditor

You can configure TAdvRichEditor to only accept to paste text as plain text from the clipboard by setting:
AdvRichEditor.ClipboardFormats := [cfText];

TMS TAdvDateTimePicker:

Showing null dates as an empty value in the TAdvDateTimePicker control

When a date(time) value of the TAdvDateTimePicker is null (Dec 30, 1899), it can be convenient to show this as empty string instead of 30/12/1899.

To do this for TAdvDateTimePicker, set AdvDateTimePicker.NullDateFormat := ' '; (one space) and AdvDateTimePicker.NullDateDate := 0.

When setting the AdvDateTimePicker.DateTime := 0, the date will show as empty text.

TMS TAdvStringGrid:

Filtering based on dates in TAdvStringGrid.

It is possible to define a filter to retain rows matching a range of dates. In the filter condition, the larger than, less than operators can be used for this. Make sure to specify the date in the condition using the system ShortDateString format, i.e. with the correct day/month sequence and the correct date separator characters. Following example code demonstrates this applied to a default grid:

procedure TForm1.Button1Click(Sender: TObject);
  fd: TFilterData;
  // filter rows based on dates in April 2017
  fd := AdvStringGrid1.Filter.Add;
  fd.Column := 3;
  fd.Condition := '>1/4/2017 & <1/5/2017';
  AdvStringGrid1.FilterActive := true;

procedure TForm1.FormCreate(Sender: TObject);
  i: integer;
  // fill the grid with data
  AdvStringGrid1.RowCount := 100;

  for i := 1 to AdvStringGrid1.RowCount - 1 do
    AdvStringGrid1.Dates[3,i] := Now + random(60);


TMS TAdvStringGrid:

Multiline header in PDF export of TAdvStringGrid

It is just a matter of a few properties to set to have multiline headers in the PDF files created from TAdvStringGrid.

To do this, drop TAdvGridPDFIO on the form and connect it to the grid.

With AdvGridPDFIO.Options.Margins.Top, configure the vertical position at the top of the page where the grid should start. To have a multiline header on top of the grid, increase this value AdvGridPDFIO.Options.Margins.Top to 100 for example. As the measurement unit is in pixels at 72DPI, this means the grid will start at 1.4” from the page top. Then configure the size that can be used for the header with AdvGridPDFIO.Options.HeaderSize. To have the header text left aligned with the grid, set AdvGridPDFIO.Options.HeaderMargins.Left equal to AdvGridPDFIO.Options.Margins.Left and set the multiline header text with AdvgridPDFIO.Options.Header.

The code becomes:

AdvGridPDFIO.Options.Margins.Top := 100;
AdvGridPDFIO.Options.HeaderSize := 100;
AdvGridPDFIO.Options.HeaderMargins.Left := 20;
AdvGridPDFIO.Options.HeaderAlignment := gtaLeading;
AdvGridPDFIO.Options.Header := 'Grid header line 1'#13'Grid header line 2'#13'Grid header line 3';

TMS TAdvStringGrid:

How to retrieve the plain text for a grid cell that contains RTF text

In the newest version of TAdvStringGrid, there is now also the possibility to retrieve the plain text for a grid cell that contains RTF text.

To do this, you can use:

  s: string;

s := AdvStringGrid.StrippedCells[col,row];
The equivalent RTF text is retrieved via:

s := AdvStringGrid.Cells[col,row];

TMS TAdvStringGrid:

Only allow to select rows via the fixed cells in a grid and disallow any other selection

This setup of a default TAdvStringGrid let's the user only select rows via the fixed left column click. Single cell selection in the grid itself is disabled:

procedure TForm1.AdvStringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
  if acol > 0 then
    CanSelect := false;

procedure TForm1.FormCreate(Sender: TObject);
  advstringgrid1.MouseActions.RowSelect := true;
  advstringgrid1.Options := advstringgrid1.Options - [goRangeSelect];

TMS WebGMaps components:

Adding a marker on double-click

This code snippet will add a marker on double-click on WebGMaps and will then show/hide a marker label upon marker click:

procedure TForm1.WebGMaps1MapDblClick(Sender: TObject; Latitude,
  Longitude: Double; X, Y: Integer);
  WebGMaps1.Markers.Add(Latitude, Longitude);

procedure TForm1.WebGMaps1MarkerClick(Sender: TObject; MarkerTitle: string;
 IdMarker: Integer; Latitude, Longitude: Double; Button: TMouseButton);
  mrk: TMarker;
  mrk := WebGMaps1.Markers.FindItemID(idMarker) as TMarker;

  if mrk.MapLabel.Text = '' then
    mrk.MapLabel.Text := 'New marker label'
    mrk.MapLabel.Text := '';


TMS FlexCel for VCL & FMX:

Conditionally format all things

Conditional formats allow a full new world of possibilities to the formatting of your documents. FlexCel currently supports everything you can throw at it, up to the latest features in Excel 2016:

Read the article about conditional formats here.

TMS FixInsight:

FixInsight and the inline directive

The Delphi compiler allows functions and procedures to be tagged with the inline directive to improve performance. If the function or procedure meets certain criteria, the compiler will insert code directly, rather than generating a call. Embarcadero docwiki gives a list of conditions under which inlining does or does not occur.

One of the basic conditions says: within a unit, the body for an inline function should be defined before calls to the function are made.

FixInsight 2017.04 introduces rule O805 “Inline marked routine comes after its call in the same unit”.

So, in this example:


TMyClass = class(TObject)
  function OptimizedCalc(value: double): double; inline
  function DoOptimizedCalc(value: double): double; 


function TMyClass.DoOptimizedCalc(value: double): double; 
   Result := OptimizedCalc(value);

function TMyClass.OptimizedCalc(value: double): double; 
   value := sqrt(value);

according to the Embarcadero docwiki, OptimizedCalc() won’t be inlined although we expected it.

This means that inlining conditions are not easy to follow, even though at first glance inline directive seems to be an easy way to slightly optimize your code. FixInsight may help to make inlining more useful by avoiding such mistakes.

Looking for even more knowledge & tips for our components

TMS software organizes two training days, one in Denmark and one in Belgium.

Sessions on TMS VCL components, TMS FNC components and TMS Cloud components will be given by Bruno Fierens, CTO from and Bernard Roussely, product manager of TMS Cryptography Pack. All sessions will be in English.

  • TMS hands-on training day in Fredericia, Denmark on May 18th - Register now
  • TMS hands-on training day in Kortrijk, Belgium on June 8th - Register now

As always, we thank all users for the numerous inputs, feedback, comments and suggestions. This is an invaluable help to steer our developments here at TMS software. We continue to look forward to all your further communications to direct our team to provide you better tools and components for your needs.

Kind regards,
TMS software team
Support, FAQ & Manuals:

Follow latest developments at

NOTICE: If you wish to unsubscribe from the TMS software Newsletter, please click here.