Rich metadata helps auto-generated Delphi forms for entry of data in the cloud

Tuesday, October 25, 2016

The service offers easy to use structured cloud data storage. The foundation of the service is of course a REST API. But meanwhile, we added several components for Delphi users to consume this service with an absolute minimum amount of effort. The first step was to create the component TAdvmyCloudData that is part of the TMS VCL Cloud Pack, TMS FMX Cloud Pack, TMS LCL Cloud Pack (and soon also in TMS .NET Cloud Pack). The TAdvmyCloudData component enables using object oriented programming techniques for using the service. In a second step, we introduced the TAdvmyCloudDataDataSet and TAdvmyCloudDataDataConnection. With these components, controls can be bound directly to the data in the cloud, be it via DB-aware controls or livebindings.

But now, we are excited to introduce the next level of automation: bound DB forms auto generated with the help of rich metadata. Two new components are available for this: TAdvmyCloudDataFormPanel and TAdvmyCloudDataFormBox. These components are similar but the TAdvmyCloudDataFormBox offers a possible scrolling area when this is needed and a header from where editing in the DB form can be started, stopped or cancelled.

When the TAdvmyCloudDataFormPanel or TAdvmyCloudDataFormBox is connected to a TAdvmyCloudDataSet via a TDataSource, it retrieves the DB field information exposed by the TDBField type in the dataset but in addition, it retrieves the rich metadata that offers. The meta data that can be set include: label, min/max values, edit mask, field lookup relation, typed values, visible, enabled ...

In this screenshot, you can see how the integer field STATUS is defined as a typed field. For typed fields, the DB form will use a combobox and this combobox will automatically map the integer data value for the selected displayed value.

The best experience is offered for the default mapping of DB field types to TMS Component Pack controls. TMS Component Pack includes a DB-aware Date+Time input control (i.e. combined date and time entry in a single control), a DB-aware combobox with a separate display and value list with binding to the value part, edit controls with built-in features to limit what can be entered etc...

The default mapping to TMS controls as such is:

boolean field: TDBCheckBox
string field: TDBAdvEdit or TDBAdvMaskEdit
integer field: TDBAdvSpinEdit
floating point field: TDBAdvSpinEdit
typed field: TAdvDBFormComboBox or TDBRadioGroup
blob picture field: TDBAdvGDIPPicture
blob rich text field: TDBRichEdit
date field: TAdvDBDateTimePicker
time field: TAdvDBDateTimePicker
date/time field: TAdvDBDateTimePicker
lookup field: TDBLookupComboBox
disabled field: TDBAdvLabel

Note that via TAdvmyCloudDataFormPanel.Layouter there is access to the class mapper and thus, a custom mapping of a field type to a different control can be done.

This is not all, not only does the metadata control how the DB form is rendered, there are also many parameters that control the behavior of the layout engine for the DB form. This includes control widths, what control types to use for what DB field types, number of columns to use, position of control labels, how to render DB field descriptions, padding, spacing, margins, fonts, what to do with readonly fields and more ...

It can also be used to change layouting on the fly. In the demo, this technique is used to let the layout switch between DB field descriptions rendered as extra labels or rendered as hints for the DB control hints:



  if ckDescr.Checked then
    AdvmyCloudDataFormPanel1.Layout.Descriptions.Kind := dkHint;
    ckDescr.Caption := 'Description as label';
    AdvmyCloudDataFormPanel1.Layout.Descriptions.Kind := dkLabel;
    ckDescr.Caption := 'Description as hint';


When the myCloudData table and its metadata is combined with the parameters for the layout engine, the result of the generated DB form in a Delphi VCL application is:

The only code needed here is to make the connection to the cloud service, i.e. setup the application key & secret, the persistence config for the access token and a single line of code to make the connection active. If we would now make an update to the database schema or its metadata and reconnect, the DB form will be automatically adapted to the new settings without having to write any code or without needing to deploy a new application executable.

Getting started

You can signup for a free subscription to the service. Then, our two products TMS Cloud Pack and TMS Component Pack will get you started. TMS Cloud Pack comes with the TAdvmyCloudDataDataSet and TAdvmyCloudDataDataConnection components. The latest version of the TMS Component Pack includes TAdvmyCloudDataFormPanel and TAdvmyCloudDataFormBox as well as a demo app. We are eager to learn how you enjoy new levels of automation in your apps but even more about all your feedback & suggestions to make this technology even more powerful.

Bruno Fierens


This blog post has not received any comments yet. Add a comment.

TMS Aurelius Free Edition now available for download!

Monday, October 24, 2016

We're happy to announce that TMS Aurelius, our highly regarded ORM (Object Relational Mapping) framework for Delphi, has now a Free Edition.

And the best part is that TMS Aurelius Free Edition has all the features that are available in the paid registered license. Not only that, but it also allows you to use it in commercial applications. So in the sense of features and usage, there is absolutely no difference in what you can use and what you can do with it compared with paid version.

The only differences are that Free Edition is only available for Delphi 10.1 Berlin, in binary format. The paid license is available for earlier versions of Delphi, comes with full source code and, of course, includes what we consider the biggest "feature" of all: it gives you high priority to our top-notch and fast support.

You can register for downloading TMS Aurelius Free Edition right now! The linked page also includes the FAQ and full table comparing the free and paid version. We hope you enjoy it!

Wagner R. Landgraf


This blog post has received 7 comments. Add a comment.

Delphi and iPhone helping vision impaired people

Friday, September 30, 2016

We released earlier this week a major update of the TMS FMX Cloud Pack. This new version adds a lot of new components covering seamless access to all kinds of interesting cloud services. Among the new services covered, two services from Microsoft stand out and open up new ways to enrich our Delphi applications with cool features. In this blog, I wanted to present the Microsoft Computer Vision and Microsoft Bing speech service. Our new components TTMSFMXCloudMSComputerVision and TTMSFMXCloudMSBingSpeech offer instant and dead-easy access to these services. Powered with these components, the idea came up to create a small iPhone app that let's vision impaired people take a picture of their environment or a document and have the Microsoft services analyze the picture taken and let Microsoft Bing speech read the result.

So, roll up your sleeves and in 15 minutes you can assemble this cool iPhone app powered with Delphi 10.1 Berlin and the TMS FMX Cloud Pack!
To get started, the code is added to allow taking pictures from the iPhone. This is a snippet of code that comes right from the Delphi docs. From a button's OnClick event, the camera is started:

  if TPlatformServices.Current.SupportsPlatformService(IFMXCameraService,
    Service) then
    Params.Editable := True;
    // Specifies whether to save a picture to device Photo Library
    Params.NeedSaveToAlbum := false;
    Params.RequiredResolution := TSize.Create(640, 640);
    Params.OnDidFinishTaking := DoDidFinish;
    Service.TakePhoto(Button1, Params);
When the picture is taken with the camera, the DoDidFinish() method is called, so we need to add the code there to deal with the image taken. We'll cover that in a moment. Let's first setup now the TMS FMX Cloud Pack components TTMSFMXCloudMSComputerVision and TTMSFMXCloudMSBingSpeech to consume the needed cloud services. You can download the components from the TMS FMX Cloud Pack page. After installing, over 60 new cloud service components will be added to your tool palette. It will be needed to get an API key to be allowed using these Microsoft services. Go to and signup for free for the computer vision API and Bing speech API and you'll receive an API key for each. In the app, two constants are used and the component's app key property is initialized when the app starts:

procedure TForm1.FormShow(Sender: TObject);
  TMSFMXCloudMSBingSpeech1.App.Key := MSBingSpeechAppkey;
  TMSFMXCLoudMSComputerVision1.App.Key := MSComputerVisionAppkey;
Now that these components are also ready to be used, let's complete the DoDidFinish() method that is triggered when the picture is taken. This method returns the image taken. This image is saved locally and will be submitted to the Microsoft computer vision API for analysis. In the app, we added via a radiobutton the choice between regular image analysis or OCR.

So, a TTask is used to start this analysis with the call TMSFMXCLoudMSComputerVision1.ProcessFile(s, cv). A TTask is used to avoid that the UI is locked during this analysis, after-all, the image must be submitted to Microsoft, processed and the result returned and parsed, so this can take 1 or 2 seconds. Depending on the analysis type, the result is captured as text in a memo control. After this, we connect to the Bing speech service.

procedure TForm1.DoDidFinish(Image: TBitmap);
  aTask: ITask;
  s: string;
  cv: TMSComputerVisionType;

  // take local copy of the file for processing
  s := TPath.GetDocumentsPath + PathDelim + 'photo.jpg';

  // asynchronously start image analysis
  aTask := TTask.Create (procedure ()
      i: integer;
      if btnAn0.IsChecked then
        cv := ctAnalysis;
      if btnAn1.IsChecked then
        cv := ctOCR;

      if TMSFMXCLoudMSComputerVision1.ProcessFile(s, cv) then
        Description := '';

        if cv = ctAnalysis then
          // concatenate the image description returned from Microsoft Computer Vision API
          for I := 0 to TMSFMXCLoudMSComputerVision1.Analysis.Descriptions.Count - 1 do
            Description := Description + TMSFMXCLoudMSComputerVision1.Analysis.Descriptions[I] + #13#10;
          Description := TMSFMXCLoudMSComputerVision1.OCR.Text.Text;

        // update UI in main UI thread
          procedure ()
            if Assigned(AnalysisResult) then
              AnalysisResult.Lines.Text := Description;
        // update UI in main UI thread
          procedure ()
            AnalysisResult.Lines.Add('Sorry, could not process image.');

In the TMSFMXCloudMSBingSpeech.OnConnected event, we can then send the text for speech synthesis to the Microsoft service and as a result we retrieve an audio stream that is then played through the device.

procedure TForm1.TMSFMXCloudMSBingSpeech1Connected(Sender: TObject);
  st: TMemoryStream;
  s: string;
  st := TMemoryStream.Create;
  s := AnalysisResult.Lines.Text;
    TMSFMXCloudMSBingSpeech1.Synthesize(s, st);
So, it doesn't take much more than this to enhance the life of vision impaired people a little and let the iPhone read out what is around them or help with reading documents.

Now, let's try out the app in the real world. Here are a few examples we tested.

Using the app on the road to read road signs and capture car license plates

Trying to figure out what we see in a showroom

First the app analyzed correctly this is a bottle of wine in the cellar and is then pretty good at reading the wine bottle label.

You can download the full source code of the app here and have fun discovering these new capabilities.

Bruno Fierens


This blog post has received 4 comments. Add a comment.

TMS VCL Cloud Pack v3.7 introduces new level of seamlessness to access cloud data

Thursday, September 22, 2016

In TMS VCL Cloud Pack v3.7, new components TAdvmyCloudDataConnection and TAdvmyCloudDataDataSet have been added. With these 2 components, access to structured data on the cloud via the myCloudData service becomes easier than ever.

TAdvmyCloudDataConnection is a non-visual component that manages access to myCloudData. It works as the intermediator for the authentication and authorization to access myCloudData for one or multiple TAdvmyCloudDataDataSet instances. This means that via the TAdvmyCloudDataConnection at least a one-time authentication and authorization is done with myCloudData to obtain the access token and the TAdvmyCloudDataDataSet can then work through TAdvmyCloudDataConnection to use this access token. To let the TAdvmyCloudDataDataSet use the connection is as simple as assigning the TAdvmyCloudDataConnection instance to TAdvmyCloudDataDataSet.Connection, just like we are used to assign a TADOConnection to a TADOTable for example.

TAdvmyCloudDataDataSet is a wrapper as a dataset of a table in the myCloudData service. When a connection is provided, set either the name of the table via the Table property or the unique ID of the table via the TableID property. When a connection has been made (i.e. access token was obtained), setting the property TAdvmyCloudDataDataSet.Active to true will fetch the table data from the myCloudData table and present it as a TDataSet through a TDataSource to any DB-aware component in VCL or via LiveBindings in FireMonkey applications. Note that this approach works both at run-time and design-time, so we can work with the cloud data at design-time to configure our DB-aware controls connected to it.

Dataset filter
An easy way is provided to perform basic dataset filtering. The TAdvmyCloudDataDataSet has a filter property which is presented as a collection of filter conditions. The filter condition consists of a field name, filter value, a filter condition logical operator and a filter comparison operator. The filter condition can be easily set at design-time where the dataset field can be picked and the values set.

From here we can work with the cloud data in much the same way from our code on the dataset as Delphi developers have been doing all the time with datasets, i.e. insert, delete, update records.

Rich metadata
But with the updated myCloudData service, there is much more than this possible as myCloudData now offers rich metadata for its structured data. This rich metadata can be programmatically accessed, created and updated but also easily configured via the myCloudData web interface. We'll cover this in a follow-up blog focused on how we can benefit from this rich metadata, but here you can already glance over the web interface you can access from your myCloudData account:

You can explore all this with a free myCloudData account. Create a new table via this account and you can use our TAdvmyCloudDataDataSetDemo application included in TMS VCL Cloud Pack to explore this.

Stay tuned for more!

Bruno Fierens


This blog post has received 2 comments. Add a comment.

TMS FNC UI Pack beta v1.5 available now for all TMS ALL-ACCESS customers!

Tuesday, September 06, 2016

We're pleased to inform TMS FNC UI Pack beta v1.5 is available now for all TMS ALL-ACCESS customers. In this beta version we've added no less than 10 NEW components! With TMS FNC UI Pack you only need to use 1 UI control set to master application development in VCL, FMX + LCL and target 5+ different operating systems.

What's new in the TMS FNC UI Pack beta release:

  • New: TTMSFNCGridDatabaseAdapter: adapter to connect the TTMSFNCGrid to any database
  • New: TTMSFNCToolBarPopup: popup version of the TTMSFNCToolBar
  • New: TTMSFNCRichEditorEditToolBarPopup & TTMSFNCRichEditorFormatToolBarPopup: popup version of the rich editor format and edit toolbar
  • New: TTMSFNCScrollBar: fully configurable scrollbar
  • New: TTMSFNCResponsiveList: responsive design list control
  • New: TTMSFNCSearchList: multi-column list with optional categorized items, pictures and text
  • New: TTMSFNCSearchEdit: editable version of the TTMSFNCSearchList
  • New: TTMSFNCHint: application / form wide HTML formatted hints
  • New: TTMSFNCURLBitmapContainer: bitmap container with the ability to download images from an URL
  • Comes with several new demos that demonstrate various features of the 10 new components we have added in this beta version.

We're eager to hear your experiences with the beta version!

A link from where the TMS FNC UI Pack beta 1.5 version can be downloaded has been added on the 'My products' page for all TMS ALL-ACCESS users. We welcome all comments, feedback & suggestions via email.

With TMS FNC UI Pack, you can target 3 frameworks and 5+ operating systems. Therefore we hope to receive as much feedback as possible about the use of these components on several platforms (VCL Win32/Win64, FMX Win32/Win64, MacOS-X, iOS, Android, LCL Win32/Win64, Mac OS-X, iOS, Android, Raspbian, ... ) and several IDE's (Delphi XE7, XE8, 10 Seattle, 10.1 Berlin, C++Builder XE7, XE8, 10 Seattle, 10.1 Berlin, Lazarus 1.4.4 or 1.6 with FPC 2.6.4 or FPC 3.0).

We look forward to all your feedback!

Nancy Lescouhier


This blog post has not received any comments yet. Add a comment.

Previous  |  Next  |  Index