DelphiBasics
TConvType
Type
Defines a measurement type as used by Convert ConvUtils unit
  type TConvType = type Word;
Description
The TConvType type defines a measurement type used in the Convert general purpose conversion utility.
 
The type should be assigned from one of the TConvFamily values. (See TConvFamily for available values).
Related commands
Convert Convert one measurement value to another
TConvFamily Defines a family of measurement types as used by Convert
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Convert UK gallons to litres
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  ConvUtils,   // Unit containing the TConvType command
  StdConvs,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  gallons, litres  : Double;
  fromType, toType : TConvType;

begin
  // Define the gallons value
  gallons := 1;

  // Convert to litres
  fromType := vuUKGallons;
  toType   := vuLiters;
  litres := Convert(gallons, fromType, toType);

  // Display both values
  ShowMessageFmt('%f UK gallons = %f litres',[gallons, litres]);
end;
 
end.
Hide full unit code
   1.00 UK gallons = 4.55 litres
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page