2010-11-13

Delphi Sort StringGrid

 I am currently coding an application in Delphi, one that requires the handling of a StringGrid. Naturally, I wanted to enhance this data-rich object with a sorting capability, but - not to my surprise - Delphi doesn't provide one so you has to code your own. After I spent some time researching (1) how to detect a click on a StringGrid header (since the ordinary onClick doesn't cover that) and (2) how to sort a StringGrid once the chosen column has been determined. I am pretty much bewildered that there is so few documentation about it-- well, okay, one of the tasks. But the other seems completely unsolveable to the Interwebs.

Anyway! Here's what I did, and it does what is requested. [...]
(show me)