Resize PNG image

The original author of the PNGImage component (the basis of the Delphi native component) had a forum where he, and others, posted code snippets on how to do things using the PNGImage component. Before the forum was taken down I grabbed a copy of all of the code snippets and placed them on the CodeGear … Read more

How to declare two inter-linked classes?

See Forward Declarations and Mutually Dependent Classes documentation. type (* start type section – one unified section “to rule them all” *) TAsyncPopulator = class; (* forward declaration, it basically serves just to fix SizeOf(TAsyncPopulator) so compiler would be able to draft dependent types’ in-memory layout. Down the CPU level `class` and `pointer` is the … Read more

Firemonkey Grid Control – Styling a Cell based on a value (via the OnGetValue function call)

Firstly, an apology. In my answer to your last question, CreateCellControl should have called inherited to create the cell. I’ve amended my answer. As for this question, I’ve uploaded my blog posting on FireMonkey Cells – http://monkeystyler.com/blog/entry/firemonkey-grid-basics-custom-cells-and-columns – it covers the stuff from the previous answer, and also covers creating custom cell controls. You’ll need … Read more

How to get line number at runtime

You can indeed use Assert for this. Write a procedure that matches the signature dictated by the TAssertErrorProc type, and then do whatever you want there. To preserve the expected behavior, you should probably call the original handler after you’re finished. procedure MichaelAssertProc(const Message, Filename: string; LineNumber: Integer; ErrorAddr: Pointer); begin LogMessage(…); SysUtils.AssertErrorHandler(Message, Filename, LineNumber, … Read more