Dataset Enumerator Reloaded

A couple of years ago I wrote a two-part article about a dataset enumerator: A Magical Gathering – Part 1 and Part 2. Well, things evolved a bit since then and I wondered how one would implement something similar given the current features of Delphi. Actually I am following here a suggestion from commenter Alan Clark. Continue reading

Posted in Delphi, Programming | 6 Comments

DprojNormalizer for XE7 and XE8

I just uploaded Version 1.0.1 of my DprojNormalizer plugin. No internal changes – only versions for XE7 and XE8 are included here. If you don’t need those you can simply skip this version.

Posted in Delphi | 7 Comments

Dproj changed or not changed? Normalize it!

I guess it is since Delphi 10 Seattle that dproj files are changed on disk even if no change was done to the project settings inside the IDE. This is a real PITA with version control systems.

Actually there are no changes to the content – it is just reordered somewhat randomly. The only consistency is that the order changes with every save operation. The reason seems to be the use of dictionaries for some entries inside the IDE.

As this bothered me a lot recently I wrote an IDE plugin that orders the dproj file in a consistent way. It is called DprojNormalizer and can be downloaded here:  DprojNormalizer

DprojNormalizer has no settings or options. It does its job while it is installed and active. If you don’t want that you have to disable or uninstall it.

If you find cases where the dproj file unexpectedly changes, please give me a note and I will see if it can be handled as well.

Posted in Uncategorized | 17 Comments

Conditionally using FastMM avoiding IFDEFs in the DPR

This a follow up of my previous post Conditional Uses Clause Considered Harmful, showing another real world use case of the technique described there.

Let’s assume we want to use FastMM with Full Debug Mode in a project to track down some errors in DEBUG mode. This requires us to include the FastMM4 unit as the first entry in the uses clause of the project DPR.

Now let’s also assume, we don’t want to use that FastMM unit in the RELEASE configuration – and – NO! – we don’t want to use an IFDEF inside the DPR, as the IDE tends to mess up with such things pretty often.

Using a unit alias like

  • FastMM4=System

solves this in a simple and elegant way.


Posted in Delphi, Programming | 14 Comments

Conditional Uses Clause Considered Harmful

Everyone writing Delphi code that is meant to compile under different Delphi versions has come to the point where conditional compilation seems unavoidable. Ever so often it tends to creep into the uses clauses as well. So, what can we do when units like System.Actions and System.ImageList simple aren’t available in older Delphi versions?

Solution 1: Add an empty unit with the proper name to the project. You might end up with a collection of empty units in your version control system. But hey, it does the job.

Solution 2: Add a unit alias to the project, mapping the unknown units to existing ones you are using anyway. For the two units mentioned above some good candidates are:

  • System.Actions=Vcl.ActnList (for versions below XE3)
  • System.ImageList=Vcl.ImgList (for versions below XE8)

There are a couple of tools that fiddle around with your uses clause from time to time. They will thank you for getting rid of conditions there.

Posted in Delphi, Programming | 5 Comments