Using Azure Translator Services with Delphi

Often when building IoT applications there is benefit in linking to 3rd party services. e.g. Heating control systems may link to weather services to help detect external influences that may effect their operation. Typically these services are exposed via JSON and REST providing multi-platform access.

Microsoft Azure data services offer access to a wide range of datasets and services and in this blog post I will take you over my journey connecting to the Azure translator data service and achieving translation of text on Windows, Mac OS X, iOS and Android thanks to the REST components and helper classes in RAD Studio XE8.

About Microsoft Azure Translator Data

Microsoft Translator is a WEB API that enables Automatic Translation (Machine Translation) of text between any of the 50 supported languages

The Azure Translator data is used by Microsoft Office, Visual Studio, Bing and many more Microsoft products. It works over REST using a mix of JSON and XML to provide a number of services including translation and text to audio.

Continue reading Using Azure Translator Services with Delphi

Linking object/TValue to a control, VCL to FireMonkey

In this post, Tag properties and using Rtti.TValue data property as an alternative in FireMonkey / FMX.

Click / Select… now what?

One common challenge we face as developers is that the user clicks on something, we now need to find the object that is required to do the next task based on the item selected.

Sometimes this is from a dataset linked to the control and it may be taken care of for us, other times, we may need to find a specific object that then has the data we need.

Most of us have done it at some time….

Yes… that naughty little trick of using the tag property of a TComponent to store a pointer to an instance of an object that you want a quick way of reaching.

I remember doing this in a POS system where buttons that represented different stock items were linked to dynamically created screens. I also remember often using the TListView and thankfully, the TListViewItem in VCL had a Data property (of type Pointer) that you can set at runtime to an instance of an object. This was a little less naughty when moving to 64bit coding when Integer and Pointer all of a sudden became different sizes, (and if it wasn’t for some insight from the Delphi team to swap tag to NativeInt – lots of code would have broken).

The problem with a pointer property (or using a NativeInt to achieve the same goal) is that it leaves a lot of typecasting in your code, which never sat easy with me.

Continue reading Linking object/TValue to a control, VCL to FireMonkey

InterBase XE7 – Update 3

InterBase XE7 – Update 3

InterBase XE7 update 3 is now available for general release.

What’s new in InterBase XE7 – Update 3?

In my post about InterBase XE7 Update 2 I mentioned about the new reserve words that are used by Change Views and how to work with reserved words by using “quotes”.


With update 3, InterBase XE7 only adds these words to the reserved list once Change Views are active in the database. This will make it easier for users to migrate to InterBase XE7 and take advantage of the other cool features like partial data dumps, improved index handling etc.

What’s fixed in InterBase XE7 update 3?

The resolved defects are documented on the InterBase XE7 DocWiki resolved defects page .


Downloading InterBase XE7 update 3

Embarcadero CodeCentral “Registered Users” can download the patch binaries (Server/Desktop/Developer/Trial) for Windows and Linux, and, ToGo Edition. You can find the downloads at

For new users, the trial and developer editions are available for free at

Using Generics & RTTI to get enum string name or enum value


This blog post looks at Enums and how multi-platform generics and RTTI (or what C# guys call reflection) make this really simple using common code on Windows, Mac OS X, iOS and Android using Delphi.

Starting with what an Enum is, the post then explores how you would traditionally have seen it written in code, before looking at the clean X-platform approach RTTI and Generics provide.

If your experienced in working with enums and want to find out how RTTI makes it easier, you may want to skip the first part of this post and get to the section about RTTI further down.

Enumerated Types to and from strings

An Enum, or Enumerated Type is a data type with a set of named values.

Enums are a great way to define a set of constants that are specific for a type and work with them in context, ensuring only one, or an array of allowed values is set.

OK, I’m going to use an example that maybe should have more values listed, but you get the point. It is the points of a compass – North, South, East or West.

  TCompass = (North, South, East, West);

  D : TCompass; // short version for Direction 
  D := TCompass.North;
  case D of 
    North : ShowMessage('North');
    South : ShowMessage('South');
    East  : ShowMessage('East');
    West  : ShowMessage('West');
    raise Exception.Create('Unknown Direction');

This provides one way to convert a Enum to a string using a case statement, but every time you make a change to your Enum types, you need to add in extra code… Call me lazy, but thats too much work!

Continue reading Using Generics & RTTI to get enum string name or enum value