Wednesday, 30 December 2020

It deploys and runs - what a Big Sur prize

- or the initial steps to get a Windows IDE to run cross-platform using CrossVCL.



Sorry about the pun, and I should also mention that this project is WIP, so no workable release/code yet.

Update: In the original image above the language selection was broken/disabled. Read the update in the end of the post on the changes I decided to do to makes this work better overall.

A few days back was a new update of CrossVCL announced in my email - for the lifetime license I had bought years earlier - which triggered an idea.

Saturday, 28 November 2020

A Set back?

- or how could I forget some set operators.


Recently a colleague of mine asked me to review some old code, and a line similar to the one below pop into my view as strange:

if (doorStates * [dsClosed, dsUnlocked] <> []) then

It had been so many years since I had used that specific syntax, that I completely forgot about some of the set operators in Pascal and Delphi - so I thought I would write up a small post on Sets in Pascal/Delphi.

In regards to the silly doorStates example above - here is a little riddle: When is a door not a door?

Saturday, 31 October 2020

Not exactly Kierkegaard - pun intended

- or the books on Delphi keep coming.

Well the pun in the title would probably need a bit of explaining, so the reference is to Søren Kierkegaard (1813-1855) - the Danish philosopher, theologian, poet, social critic and religious author who is widely considered to be the first existentialist philosopher - but his surname is also pronounced as the Danish word for graveyard or churchyard.

I sometimes still hear people say, that nothing is happening in relation to Delphi in general or more specific in the Delphi book area - but that is not true.

It might have been many years since a Danish book on Delphi was published - but there where many in the early days - I had only 2 of the 15-16 published, all the rest I had were in English. So the scene for Danish Delphi books does feel like a "kirkegård".

And it is all my fault - I do prefer my technical books (and my software) in English, and I am sure most Danish developers feel the same.

But when you look at the number of English books that has been published the last couple of years - the technical quality, the passion, level of detail and diversity of topics matches greatly what also has been going on in the rest of the Delphi community - if you haven't noticed you might be looking in the wrong places.

Fellow Embarcadero MVP Patrick Prémartin has started to setup a nice site called delphi-books.com - some books still need to be added at the time of writing this. - no books in the Danish section yet - but covers are scanned. Update: Patrick has uploaded the info and covers I provided him with - and also published an extensive open-data API for the site.

I know Patrick has grouping by "year published" on his to-do list, that will help indicate how much great content has been published in traditional book form the latest years - so a big thanks to all the authors and publishers - for keep doing this non-trivial task of writing books.

It is almost 30 years since I co-authored two books on Paradox DOS - in Danish and just prior to Paradox Windows was launched - they were not bestsellers btw 😁. But I still remember the tolls it took on everyone, and still surprised that my then to-be-my wife, stayed.

/Enjoy some of these great books.

Wednesday, 30 September 2020

Good on ya, mate!

- or a shout-out for Alister Christie's new book: Code Faster in Delphi.

I just got a chance to review the first of a series of new books about Delphi from Alister Christie, and even if it is a short book - 160 pages - it is perfect and on the spot - looking forward to the next in the series.

You can get the book here: https://leanpub.com/codefasterindelphi - just take a look at the Table Of Content - a lot of great stuff.

Alister Christie has been doing his LearnDelphi.tv for many years - and his 150+ short videos are always to the point - on topic and precise - at least those I have seen :)

And speaking of video - watch his promotional video for the book - always fun and this one has WordStar bits :)

I will get my dead tree version as well - even if shipment cost probably will exceed the price of the book - but I want this nice books content and cover on my bookshelf.

Speaking of cover - as a little bonus I found this on 99designs: https://99designs.dk/book-cover-design/contests/code-faster-delphi-book-1018068 - so if anyone has a potential writer in them, this shows one process of getting a nice cover selected.

It has been more than 25 years since I last wrote a book - even if self publishing and cover contents are now a thing - it is not a trivial task - as I remember it, so well done - and thanks.

/Enjoy Alister's new book.

Monday, 31 August 2020

Hygge by the fireside

- or a fireside chat with Jim McKeeth


End April in the evening Jim and I had a fireside chat, which should had been in front of our masonry oven - but I ended up having it from my home office.




You can see the chat here - it is a bit long but I think we had fun, and to help you through it, I have done this post as a commentary track, and put a bit more details in various places.

And the word hygge now seems to have gotten into the Oxford English Dictionary - but still pronounced wrong :)

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: