Posts

Showing posts from September, 2010

DelphiDabbler Code Library help

Some users of the components and units from the DelphiDabbler Code Library have contacted me to ask if the library's help is available in HTML help format because WinHelp format I used for the library won't work by default on Windows Vista and later.The answer is no - and I don't have time to do the conversions.However, all is not lost because there is now a Wiki for each of the Code Library projects hosted on Google Code. In future the Wikis will be updated in preference to the old WinHelp help files.View the list of available Wikis.Source code highlighting by DelphiDabbler PasHi.

Initialising dynamic arrays - take 2

In my earlier post on this subject I presented some methods to use to initialise and clone dynamic arrays. Some comments to that post suggested a simpler approach using compiler features I didn't know existed. In this post I've simply collected the information from those comments together in one place.To initialise an array from literal values you can use the special array constructor provided by the compiler:usesTypes;varA:TIntegerDynArray;beginA:=TIntegerDynArray.Create(1,2,3,4);...end; This also works when you define your own array types, for example:varTMyByteArray=arrayofByte;beginA:=TMyByteArray.Create(1,2,3,4);...end; And it also works for the TArray<T> generic array type:varIntArray:TArray<Integer>;StrArray:TArray<string>;beginIntArray:=TArray<Integer>.Create(1,2,3);StrArray:=TArray<string>.Create('bonnie','clyde');...end; The above constructors will only initialise an array from constant values. To make a copy of an existing …