Firemonkey ScrollBox Bug

After having all sorts of problems with scrolling, I have come to the conclusion that there is an initialisation problem with scrolling components in firemonkey, which manifest in dodgy scrolling behaviour. Sometimes it will work and sometimes it will not… After having thought that I fixed the problem several times, only to watch the problem … Read more

Delphi XE8 bug in TList, need workaround

I found that now the TList<T>.Insert method call TListHelper.InternalInsertX depends on the data size, in my case: procedure TListHelper.InternalInsertN(AIndex: Integer; const Value); var ElemSize: Integer; begin CheckInsertRange(AIndex); InternalGrowCheck(FCount + 1); ElemSize := ElSize; if AIndex <> FCount then Move(PByte(FItems^)[AIndex * ElemSize], PByte(FItems^)[(AIndex * ElemSize) + 1], (FCount – AIndex) * ElemSize); Move(Value, PByte(FItems^)[AIndex * ElemSize], … Read more

Delphi TList of records

The easiest way is to create your own descendant of TList. Here’s a quick sample console app to demonstrate: program Project1; {$APPTYPE CONSOLE} uses SysUtils, Classes; type PMyRec=^TMyRec; TMyRec=record Value: Integer; AByte: Byte; end; TMyRecList=class(TList) private function Get(Index: Integer): PMyRec; public destructor Destroy; override; function Add(Value: PMyRec): Integer; property Items[Index: Integer]: PMyRec read Get; default; … Read more

Delphi: why breakpoints from time to time are not usable (green highlighted line on IDE)?

Debug info isn’t present in the file. Make sure that you’re using the Debug configuration. (Project Manager tree, expand Build Configurations, make sure Debug is bold. If it’s not, right click Debug and choose Activate from the context menu.) Make sure you then do a Build of your project, not just a Compile. If that … Read more

How to diagnose COM-callable wrapper object creation failure?

You can use the assembly binding failure logging feature – it needs to be enabled and then you can use the fusion log viewer to see the results http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx Not sure how you will get this onto your clients machines. When I first read this my first thought was given it seems most common on … Read more

Using Case Statement with String

In Jcl library you have the StrIndex function StrIndex(Index, Array Of String) which works like this: Case StrIndex(‘SomeName’, [‘bobby’, ‘tommy’, ‘somename’]) of 0: ..code.. ;//bobby 1: ..code..;//tommy 2: ..code..;//somename else ShowMessage(‘error’); end.

How do I make a PNG resource?

Example text file (named myres.rc): MYPNG RCDATA mypng.png Added to project: {$R ‘myres.res’ ‘myres.rc’} Example of loading at runtime: uses PngImage; var Png: TPngImage; begin Png := TPngImage.Create; try Png.LoadFromResourceName(HInstance, ‘MYPNG’); Image1.Picture.Graphic := Png; // Image1: TImage on the form finally Png.Free; end; end;