Friday, 31 July 2020

I am no Charles TDickensionary<>

- or a few TDictionary<> tricks.


One of my favourite classes in Delphi is TDictionary<> - might be because it resembles a database table which can have composite keys, and I have always been a ClientDataset/VirtualTable/FDMemTable fan-boy :)

I do not get to use the memTables that much i recent years, and the RTL generic collections also got better - while not on par with third party collections like Spring4D - which I also not get to use much.

I recently had a task where I had to transform some code that was collecting data from an external source, that provided data in a way that multiple iterations had to be done, before each row/item was complete - since data was coming in subsets per field/property. TDictionary<> to the rescue.


Monday, 27 July 2020

TTreeview your TOutline

- or migrating a TOutline to a TTreeview many years too late.


HighDPI themed Delphi 10.4 TOutline and TTreeview

The task to migrate from a working old TOutline to a TTreeview was long overdue in a small program I almost use daily - and its code had not really been touched since it was created.

TOutline was included in Delphi 1 back in the Win 3.1 days, and since Windows did not have any Treeview/Outline in its common controls it was purely VCL, not a wrapper.

It has for many years been advised to not use TOutline for any new projects, but instead use TTreeview or similar - but once in a while I do bump into this component - and this time I thought I would write a small and incomplete migration guide.

Thursday, 18 June 2020

D&D in Delphi source code?

- or does your device support Phone, Tablet or Elf?!




While looking through some of the RTL source code, in the quest for the "Tablet" mode (see my previous post from yesterday) - I stumbled upon the TDeviceInfo.TDeviceClass enum.

Wednesday, 17 June 2020

A cure for Win10 in Tablet mode

- or how to detect tablet mode in Windows 10 from Delphi.



Sorry about the cure-tablet pun, but Windows 10 is not able yet to enter Pill mode.

This small post is actually also about wrapping Win10 SDK apis, that might not have been fully implemented as Delphi classes/interfaces or are missing because of their little use - which incidentally is that ones I often miss.

I was getting a bit frustrated refactoring some old code, and thought that it would be fun to add a Windows 10 feature to the project instead - and since I was sitting on an old Surface - I could switch that into "Tablet" mode.

Sunday, 24 May 2020

May the "Default" be with you

- or bit of housekeeping in some very old code.

Since we are still in the month of May - I though I could get away with that title - but this small post is not about calendar months or Star Wars.

I have not been very active here for a while - but I wanted to write a bit on the lack of use of StrToXDef, TryStrToX and overloaded constructors that now have been in the RTL for many years.

Just preparing an old Delphi project for the upcoming 10.4 release (real soon now) - and I stumbled upon some horrid old code like this:


Wednesday, 12 June 2019

Bringing the POX cross-platform

- or a few things on the extended RTTI and new inline variables presented in 10.3.



Having figured out the internals of the POX file format used in the game Siege of Avalon, and it's sibling from the modding community: Ashes of Avalon, Pillars of Avalon and Days of Ahoul to name the larger ones - enables to revise the tooling used for the engine - most of it closed source or requiring jumping through hoops while juggling.

So the first thing I brewed together is a POX file viewer/player with an export function. A preliminary test was done in the previous post, but I redid it using the FMX multi-device UI framework that comes with RAD Studio/Delphi/C++Builder - so that modders using for instance macOS, do not need to run in a virtual OS - and it all comes for "free" when using FMX.

Saturday, 8 June 2019

Cure for POX found in Avalon

- or how reverse engineering makes a game engine portable.



One thing that can stop software from being portable and surviving the decay of time, is when closed and proprietary file formats block any chance of progress - the game Siege of Avalon has the POX.