Delphi source code

A global UNIT with functions and procedures


For complex projects, I advise you to put your "general" (globally used) variables, constants, functions and procedures in a separate unit. Such a "global" unit does not have a corresponding form. All other units that use your general routines, have to refer to your global unit through a USES-clause. An example of such a unit might look like this:

unit GlobalRoutines;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, ..., ...;

procedure SetDateTime(Year, Month, Day, Hour, Minu, Sec, MSec: Word);
...
var
  Var1, Var2, Var3: string;
  DoIt: Boolean;
  ...
const
  CR = #13;       // "Enter" key, "Carriage Return"
  CRLF = #13#10;  // Carriage Return + LineFeed

implementation

procedure SetDateTime(Year, Month, Day, Hour, Minu, Sec, MSec: Word);
begin
  ...
end;

...
end.

Note that you have to define all constants, variables, procedures and functions that you want to call from other units, in the interface section of the unit !
 


 
Crash Course Delphi Become member of the DelphiLand Club and get our Crash Course Delphi, plus the fully commented source code of numerous projects, plus guaranteed answers from our Q/A Forum. Membership is for life!

DelphiLand Club Membership  DC Library  Forum  Forum Archives 
Crash Course Delphi  Tips  Source Code  Downloads  Links 

© Copyright 1999-2016 
Studiebureau Festraets