Adding New Measurement Types
Go Up to Using the RTL Index
If you want to perform conversions between measurement units not already defined in the System.StdConvs unit, you need to create a new conversion family to represent the measurement units (TConvType values). When two TConvType values are registered with the same conversion family, the Convert function can convert between measurements made using the units represented by those TConvType values.
You first need to obtain TConvFamily values by registering a conversion family using the RegisterConversionFamily function. After you get a TConvFamily value (by registering a new conversion family or using one of the global variables in the System.StdConvs unit), you can use the RegisterConversionType function to add the new units to the conversion family.
The following examples show how to do this:
For more information, refer to the source code for the standard conversions unit: StdConvs.pas.
For more information, refer to the source code for the standard conversions unit: StdConvs.hpp.
Note: The source might not be included in all editions of the product.