Knowledge Base Alert March, 2015




TMS FlexCel for VCL & FireMonkey:

Installation & compilation of TMS FlexCel

Due to its complexity FlexCel takes a while to compile. We are speaking about 1700 units with 700,000 lines of code, and a “mini-excel” which even includes a full PDF engine.

1) A full compilation for all platforms including debug and release configurations can take about 2 or 3 minutes. Most of the time is spent in mobile compilers like iOS and Android which are much slower than the Win32 compiler. If a full compilation takes up to 8 hours, then there is probably something wrong in the setup. (Antivirus, some unexisting library paths pointing to network locations could slow down compiling)

2) You should be compiling FlexCel just once: When you install it. Setup is similar to the VCL itself, it puts all dcus in the library path, and not the .pas files. And the result is similar, once you install it, it runs fast (recompiling the VCL would take many minutes too, again due to the complexity of it)

One way to speed it up, if you aren’t using the FireMonkey part, is to deselect it on setup:


Custom background colors in a Planner header

By default, the background color for header cells in the Planner is set with Planner.Header.Color / Planner.Header.ColorTo and this color is applied to all header cells. If there is a need to draw attention to a specific position in the Planner, it is easily possible to set a specific header for this position in a different color. This can be done by implementing the OnHeaderDrawProp() event like:

procedure TForm5.Planner1HeaderDrawProp(Sender: TObject; SectionIndex: Integer;
  var AColor, AColorTo: TColor; AFont: TFont);
  if (SectionIndex = 1) then
    AColor := clYellow;
    AColorTo := AColor;
The SectionIndex is the index of the header cell, starting with 0 for the first position. With AColor & AColorTo parameters, the background gradient color can be set.


Download files only when newer version than local copy is available

With TWebCopy, the component to upload or download files via HTTP / FTP, it is easy to instruct the component to only start a download when a newer file version is available online. To do this, all that needs to be done is set the option WebCopyItem.CopyNewerOnly = true and set the date to check against via WebCopyItem.FileDate. In this case, we’d set this date to the local file date:

procedure TForm5.CheckAndDownloadNewDoc;
  wci: TWebCopyItem;

  wci := WebCopy1.Items.Add;
  wci.URL := '';
  wci.CopyNewerOnly := true;
  wci.FileDate := FileAge('c:\Doc\TMS%20Spell%20Check.pdf');
  wci.TargetDir := 'c:\doc';


  if wci.NoNewVersion then
    ShowMessage('No new version found')
    ShowMessage('New file from '+DateToStr(wci.NewFileDate) + ' found');


How to export TAdvStringGrid to PDF

Drop a TAdvgridPDFIO component on the form and connect the TAdvStringGrid to this nonvisual component's TAdvStringGrid property.

Then simply call:

After you called Save(FileName) you can call:

to automatically open this PDF after having it produced. TAdvgridPDFIO comes with settings for header and footer as well as metadata. Header and footer can as such be optionally generated for the PDF file independently from the TAdvStringGrid content.


How to add multiline comments

You can add multiline comments with:
  AdvStringGrid1.SHowHint := true;
  AdvStringGrid1.AddComment(1,1,'this is line1'#13#10'and here line 2'); 

The hint normally auto sizes, the max. width can be set via:
  AdvStringGrid1.ControlLook.HintMaxWidth := 50;

When using xlsexport, you can also save the comment when you set:
   AdvGridExcelIO.Options.ExportCellProperties = true 


Programmatically adding items

To add values to a TAdvDBComboBox programmatically, by far the easiest solution is to use the method AdvDBComboBox.AddDisplayAndStoredValue. Example:
  AdvDBComboBox1.AddDisplayAndStoredValue('>1000 and <10000 ','1');
  AdvDBComboBox1.AddDisplayAndStoredValue('>10000 and <50000 ','2');
  AdvDBComboBox1.AddDisplayAndStoredValue('>50000 and <100000 ','3');
  AdvDBComboBox1.AddDisplayAndStoredValue('>100000 and <500000 ','4');
  AdvDBComboBox1.AddDisplayAndStoredValue('>500000 and <1000000 ','5');

Where the first value is what will be displayed in TAdvDBComboBox and the 2nd value what will be stored in the DB field.

To clear items programmatically, you can use:


How to customize the items to have a Bubble message list

You can easily override the item shapes with the OnItemCustomize event. Below is a small sample that demonstrates this:
procedure TForm1.TMSFMXTableView1ItemCustomize(Sender: TObject;
  AItem: TTMSFMXTableViewItem; AItemShape: TTMSFMXTableViewItemShape;
  AItemControlShape: TControl);
  if Odd(AItem.Index) then
    AItemShape.Margins.Left := 50;
    AItemShape.Fill.Color := TAlphaColorRec.Lime;
    AItemShape.Margins.Right := 50;

  AItemShape.Margins.Top := 5;
  AItemShape.Align := TAlignLayout.Top;
  AItemShape.Corners := AllCorners;


How to set the text alignment

Many users try to set the text alignment via the TextAlign property. The TextAlign property does not apply to the text string, but to the text control. You can notice this as the property isn't a TTextAlign property but a TAlignLayout property.

You can use the following code to left-align the text. The OnApplyStyleLookup event can be used to access the image and text object that are used inside the TTMSFMXButton:
procedure TForm1.TMSFMXButton1ApplyStyleLookup(Sender: TObject);
  TMSFMXButton1.HTMLText.HorzTextAlign := TTextAlign.Leading;

You can also shift the text object with the margins property (if the text object is client aligned):
procedure TForm1.TMSFMXButton1ApplyStyleLookup(Sender: TObject);
  TMSFMXButton1.HTMLText.HorzTextAlign := TTextAlign.Leading;
  TMSFMXButton1.HTMLText.Margins.Left := 5;


How to combine 3 controls/functions in 1 cell

To combine for example a ReadOnly column + an editable column + a CheckBox column in 1 cell we can create a custom cell. First inherit from TTMSFMXCheckedGridCell which already has built-in support for editing and managing a checkbox. Additionally a label can be added, and with an override of the GetTextRect function it's possible to limit the editing area.

Here you can download a sample that demonstrates this.


How to access the current TRectF of a grid specific cell

You can retrieve the grid cell rectangle with XYToCell:

procedure TForm1.TMSFMXGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Single);
  cl: TCell;
  obj: TControl;
  cellr: TRectF;
  cl := TMSFMXGrid1.XYToCell(X, Y);
  obj := TMSFMXGrid1.GetCellObject(TMSFMXGrid1.GetDisplayCell(cl));
  if Assigned(obj) then
    cellr := RectF(obj.Position.X, obj.Position.Y, obj.Position.X + obj.Width, obj.Position.Y + obj.Height); 


How to change the text of the 'Edit' button depending you're in edit mode or not + how to remove the 'Move' button.

Below is a small sample that demonstrates how your can change the text of the 'Edit' button depending you're in edit mode or not + how you can remove the 'Move' button.
procedure TForm136.ChangeEditButton(AEditButton: TTMSFMXBarButton);
  if TMSFMXTableView1.isEditMode then
    AEditButton.Text := 'Hello'
    AEditButton.Text := 'World';

procedure TForm136.EditClick(Sender: TObject);
  if TMSFMXTableView1.isEditMode then

  ChangeEditButton((Sender as TTMSFMXBarButton));

procedure TForm136.TMSFMXTableView1ApplyStyleLookup(Sender: TObject);
  b: TTMSFMXBarButton;
  b := TMSFMXTableView1.GetEditButton as TTMSFMXBarButton;
  (b as TTMSFMXBarButton).OnClick := EditClick;
  (b as TTMSFMXBarButton).AllowCustomize := True;
  TMSFMXTableView1.GetMoveButton.Visible := False;
  TMSFMXTableView1.GetMarkButton.Align := TAlignLayout.alClient;
  TMSFMXTableView1.GetArchiveButton.Align := TAlignLayout.alLeft;
  TMSFMXTableView1.GetArchiveButton.Width := (TMSFMXTableView1.Width - (TMSFMXTableView1.GetArchiveButton.Margins.Right * 5)) / 2

Installing IntraWeb components

Making sure you use the correct file

If following error appears at compilation of your package:
[dcc32 Error] xxxx.pas(271): E2003 Undeclared identifier: "..." or
[dcc32 Error] xxxx.PAS(400): E2010 Incompatible types: 'PInteger' and 'Integer'

This indicates you are not using the correct file. Please make sure that the correct version of has been placed in the folder where the source file of the product are installed.

Correct include files are:
  • IntraWeb 10: Rename TMSDEFS10.INC to TMSDEFS.INC
  • IntraWeb 11: Rename TMSDEFS11.INC to TMSDEFS.INC
  • IntraWeb 12.0.x: Rename to TMSDEFS.INC
  • IntraWeb 12.1.x: Rename to TMSDEFS.INC
  • IntraWeb 12.2.x: Rename to TMSDEFS.INC
  • IntraWeb 14.0.x: Rename to TMSDEFS.INC
Please note that the file is not required to install the trial version.

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.