      

     3 

          ,     
Delphi,        ,  
     Delphi.     
   ,     , 
   Delphi.      
           
.        ,   
       4, "". 
           ,   
Delphi   .  ,   , , 
 , ,     .  ( 
 ,     ) ,   
    ,  . 

        

         (project)  -.  
      ,      
.       , 
 .  ,     
  ,          
 .     .    
          
   .   ,     
       . 

     Delphi 

     Delphi     ,    
 .  Delphi      
 ,           
,      .  ,  
Delphi       Object Pascal,    
    . 

      
           
 .    ,  Delphi     
   ,   ,   
    ,      Delphi,   
   "  " . 

     3.   47 

       Delphi   ,    
    ,      
,         
  Pascal.         
     ,    .   
     .   3.1    
 Delphi. 

      
       ,   ,  
 .    ,  Novell 
Netware .,    .     
 .    ,   . 

     3.1.   RENTMAN 

    program RENTMAN; 

    uses 
      Forms, 
      RENTDATA in 'RENTDATA.pas' {dmRENTMAN: TDataModule'}, 
      ANYFORM in '..\..\CH09\CODE\ANYFORM.pas' {fmAnyForm}, 
      DBFORM in '..\..\CH09\CODE\DBFORM.pas' {finDatabaseForm}, 
      EDITFORM in ' .. \..\CH09\CODE\EDITFORM.pas' {fmEditForm}, 
      REMPENTO in 'REMPENTO.pas' {fmREMPENTO}, 
      RSYSMANO in 'RSYSMANO.pas' { fmRSYSMANO}, 
      RWKTENTO in 'RWKTENTO.pas' {fmRWKTENTO}, 
      CGRDFORM in '..\..\CH09\CODE\CGRDFORM.pas' {fmControlGridForm}, 
      RTENCGDO in 'RTENCGDO.pas' (fmRTENCGDO}, 
      RPROCGDO in 'RPROCGDO.pas' {fmRPROCGDO}, 
      RLEACGDO in 'RLEACGDO.pas' {fmRLEACGDO}, 
      MSTRFORM in 'MSTRFORM.pas' {fmMasterDetailForm}, 
      GRIDFORM in 'GRIDFORM.pas' {fmGridForm}, 
      RWORGRDO in 'RWORGRDO.pas' {fmRWORGRDO}, 
      RWORMDEO in 'RWORMDEO.pas' {fmRWORMDEO}, 
      RCALGRDO in 'RCALGRDO.pas' {fmRCALGRDO}, 
      RCALEDTO in 'RCALEDTO.pas' {fmRCALEDTO}, 
      RPROLSTO in 'RPROLSTO.pas' {frRPROLSTO}; 
    
    ($R *.RES) 

    begin 
      Application.Initialize; 
      Application.HelpFile := 'C:\Data\Word\CSD\CH13\Code\Rentman.hlp' ; 
      Application.CreateForm(TfmRSYSMANO, fmRSYSMANO) ;
      Application.CreateForm(TdmRENTMAN, dmRENTMAN) ; 
      Application.CreateForm(TfmREMPENTO, fmREMPENTO) ;
      Application.CreateForm(TfmRWKTENTO, fmRWKTENTO) ;
      Application.CreateForm(fmRTENCGDO, fmRTENCGDO) ;
      Application.CreateForm(TfmRPROCGDO, fmRPROCGDO) ;
      Application.CreateForm(TfmRLEACGDO, fmRLEACGDO) ;
      Application.CreateForm(TfmRWORGRDO, fmRWORGRDO) ;
      Application.CreateForm(TfmRWORMDEO, fmRWORMDEO) ;
      Application.CreateForm(TfmRCALGRDO, fmRCALGRDO) ;
      Application.CreateForm(TfmRCALEDTO, fmRCALEDTO) ;
      Application.CreateForm(TfrRPROLSTO, frRPROLSTO) ;
      Application.Run ;
    end. 

      program 

         program     3.1. 
  ,       
 .  ,      
    ,   program 
  library  unit, . 

    48  I.  

     uses 

      uses    Object Pascal,  
 Delphi        
 .   (unit)   ,   
 ,   Delphi.     
      ,  ,  
   "",       
,       
.         
  make. 
     Forms,     3.1    
,         (VCL  
Visual Component Library) Delphi.   ,    
,       , 
  Delphi.  .   , 
    .      
,  ,     ,    
,    .       Name 
   Form   ,       
Object Inspector Delphi.   ,   Delphi    
 ,     ,    ,   
 - ,  , ,   . 
    Delphi        , 
     () . 

     $R 

        .  3.1    
  $R.   ,     
  Windows,    .  , 
    , ,     
    .       
Delphi       ,      
.  -          
 , Delphi    File not found xxx.RES. 

    Application.CreateForm 

     Application.CreateForm      
.            
.          
  Options=>Projects     
 (IDE  Integrated Development Environment) Delphi.    
        
( fmRSYSMANO),    interface   
.        uses   
  ,          
     CreateForm  Application.  
Application.CreateForm        
       . 
       Application.CreateForm  
,    . ,    
  Application.CreateForm,    . 
      ,     
,    Project=>Options=>Application. 

    Application.Run 

      Run  Application    
.      ,   
  ,      
 . 

     

     Delphi        
  (DLL) Windows.      
  Windows,   Object Pascal   
,    DLL,    library  

     3.   49 

exports.     ,    ,   
      program,  , 
      DLL,   .    
 exports  ,      
 DLL   .   3.2   
    DLL. 

     3.2.  StrUtil 

    library StrUtil; 

    Uses 
      SysUtils; 
    function Pad(InString: String; Len: Integer): String; 
    begin 
      Result:=Format('%-*s', [Len, InString]) ; 
    end; 
    function LPad(InString: String; Len: Integer): String; 
    begin 
      Result:=Format('%*s',[Len, InString]) ; 
    end; 
    exports 
      Pad index 1; 
      LPad index 2; 
    begin 
    end. 

        3.2,        
     .  ,   
     library,   program.  
exports  ,   Pad  LPad    
,         . 

      

       ,     ,    Delphi 
 .     ,  
  ,     , 
        . 
      ,     ,   
 .        
 ,     .   
   ,   Delphi   
      .      
          
    .  , Delphi   
          
,        
,   .     
      3.3. 

     3.3,      

    unit RTENCGDO; 
    interface 
      uses 
         Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
         CGRDFORM, Buttons, DBCtrls, StdCtrls, DBCGrids, ExtCtrls, Mask; 
      type 
        TfmRTENCGDO = class(TfmControlGridForm) 
          detTENANT_NUMBER: TDBText; 
          dedNAME: TDBEdit; 
          dedEMPLOYER: TDBEdit; 
          dedEMPLOYERADDRESS: TDBEdit; 
          dedEMPLOYERCITY: TDBEdit; 


    50  I.  


      dedEMPLOYERSTATE: TDBEdit; 
      dedEMPLOYERZIP: TDBEdit; 
      dedHOMEPHONE: TDBEdit; 
      dedWORKPHONE: TDBEdit; 
      dedICEPHONE: TDBEdit; 
      dedCOMMENTS: TDBEdit; 
      Name: TLabel; 
      Label2: TLabel ;
      Label3: TLabel ;
      Label4: TLabel ;
      Label5: TLabel ;
      Label6: TLabel ;
      Label7: TLabel ;
      Labels: TLabel ;
      Label9: TLabel ;
      Label11: TLabel ; 
      Label1: TLabel ;
    private 
      { Private declarations ) 
    public 
      ( Public declarations } 
    end; 

    var 
      fmRTENCGDO: TfmRTENCGDO ; 
      DefaultPetDeposit: Integer; 

    implementation 

    uses RENTDATA; 

      ($R *.DFM) 

    initialization 
      DefaultPetDeposit := 150; 
    end. 

     interface 

        3.3,      , 
   interface, implementation  initialization.  
       , 
     .     
   ,  ,   .  
       ,     
    ,   . 
,    ,   Object Pascal      
  ,    ,   
    .    
      .  
    uses      
,         
 ,       
 . 
            
-   .  ,   
        
 ,   . (  
       ,    
      .) ,   
    ,    , 
     C++. 

     implementation 

      (implementation)     
.  ,    ,    
  .          
  ,    -

     3.   51 

     .    
        
interface,        implementation. 

       

         ,    
    (.  3.3): 

    var 
      fmRTENCGDO: TfmRTENCGDO; 

       ,   
fmRTENCGDO,    TfmRTENCGDO.  TfmRTENCGDO     
   Delphi ,    TForm. 
 fmRTENCGDO   Application.CreateForm,  
   .        
 ,           
,   uses     ,     
. 

     initialization 

      ,       - 
,        
.  ,     ,   
   .      
    uses .   3.3  
    ,     
initialization  end. 

    initialization 
      DefalutPetDeposit := 150; 
    end. 

        DefaultPetDeposit   
  150.  ,      , 
   ,     . 

     finalization 

             
  ,    finalization. 
,    ,     
.        
,  .      
    end. . 

     

      ,    Delphi,    
.   ,      
     ,     
  .   ,     , 
          , 
        . 
     ,     , 
  Delphi,   ,     , 
        ,   
 ,     ,     
 .   3.4       . 

    52  I.  

     3.4.     

    inherited fmDatabaseForin: TfitiDatabaseForm 

       Left = 75 
       Top = 124 
       Width = 554 
       Caption = 'fmDatabaseForm' 
       PixelsPerInch = 96 
       TextHeight = 13 
       inherited paTop: TPanel     
          Width =546 
      end 
      inherited paMiddle: TPanel     
        Width = 546 
      inherited paBottom: TPanel 
        Width =546 
       object paRight: TPanel 
           Left = 385 
           Top = 1 
           Width = 160 
           Height = 37 
          Align = alRight 
          BevelOuter = bvNone 
          TabOrder = 0 
         object bbOK: TBitBtn 
            Left = 4 
           Top = 8 
           Width = 75 
           Height = 25 
          TabOrder = 0 
          Kind = bkOK 
       end     
       object bbCancel: TBitBtn 
         Left = 82 
         Top = 8 
         Width = 75 
         Height = 25 
         TabOrder = 1 
         Kind = bkCancel 
      end 
    end     
    object bbPrintForm: TBitBtn 
       Left = 280 
       Top = 8 
       Width = 75 
       Height = 25 
       Caption s: 'Print Form' 
       TabOrder = 1 
       OnClick = bbPrintFormClick 
       Glyph. Dat.a = {     
          76010000424D7601000000000000760000002800000020000000100000000100 
           04000000000000010000130000013000000000000000 
           800000800000008080008000000080008000808000007F7F7FOOBFBFBFOOOOOO 
           FFOOOOFFOOOOOOFFFFOOFFOOOOOOFFOOFFOOFFFFOOOOFFFFFF00300000000000 
          00033FFFFFFFFFFFFFFF0888888888888880777777777777777F088888888888 
          8880777777777777777FOOOOOOOOOOOOOOOOFFFFFFFFFFFFFFFFOF8F8F8F8F8F 
          8F80777777777777777F08F8F8F8F8F8F9F0777777777777777FOF8F8F8F8F8F 
          8F807777777777777F7F0000000000000000777777777777777F3330FFFFFFFF 
          03333337F3FFFF3F7F333330FOOOOFOF03333337F77773737F333330FFFFFFFF 
          03333337F3FF3FFF7F333330FOOF000003333337F773777773333330FFFFOFFO 
         33333337F3FF7F3733333330F08FOF0333333337F7737F7333333330FFFF0033 
         33333337FFFF7733333333300000033333333337777773333333) 
    NumGlyphs = 2 
  end 
  object DBNavigatorl: TDBNavSearch 


     3.   

         Left = 8 
         Top = 8 
         Width = 253 
         Height = 25 
         TabOrder = 2 
       end 
     end 
  end 


      

     Delphi         
 (data module).       
 New Data Module,    File   Delphi. 
        
 (        )   
.   ,          
,  ,        . 
 ,  ,    ,     
 Delphi,          
  . ,        
 . 

      

     Delphi,      , 
   .   (include files) 
   ,  ,     
    .  Delphi   
      ,    
  ,    . 
            
,    ,    , 
        
    .     . 
    
    {$-, F-, G+, I-, +, -, +, Q-, R-, S+, -, V+, W-, X+} 
    {$IFNDEF DEBUG} 
      <$D-} 
    ($ELSE) 
      {$D+, L+, Y+) 
    {$ENDIF} 
    
            
  .     {$IFNDEF DEBUG}.  
,    ,       
 DEBUG,      ($D, $L  $Y)   
. (       $D,   
        .) 
   DEBUG ,     .  
 ,          
,           
   DEBUG.       
,         , 
    Project=> Options. 
              
    $I, : 

    {$I WINMAC32.INC} 

      
           ,  
   .   Delphi    
 ,       
     Project Options  
,      . 

    54  I.  


     

       ,    Delphi  , 
 ,   ,  . 
    ,         
  Delphi,        
   Object Pascal.   3.5     
 . 

     3.5.    bl,    

    ( 
       . 
          ,  . 
           : 
      Records[RecNum].Fields[FieldNum].AsType 
         . 
      Copyright () 1995 by Ken Henderson. 
    } 
    unit bl; 

    interface 

    uses 
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
Db, DBTables; 

    type 
      bl = class (TTable) 
      private 
          {    } 
          function GetRecords(RecNum: Longint): TDataSet; 
       protected 
          {      } 
       public 
          (    } 
          property Records[RecNum: Longint]: TDataSet read GetRecords; 
       published 
          {    } 
      end; 

    procedure Register; 

    implementation 

    function TArrayTable.GetRecords(RecNum: Longint): TDataSet; 
    begin 
      First; 
      MoveBy(RecNum) ; 
      Result := Self; 
    end;

    procedure Register; 
    begin 
      RegisterComponents('Data Access', [TArrayTable]); 
    end; 

    end. 

          Table Delphi 
        Records.  
           
. ,     

     3.   55 

,         
      (   Records 
 bl,    Fields  Table,  ): 

    TArrayTable1.Records[4].Fields[2].AsString; 

     ,        . 
       ,  
  New Component  Component   Delphi.  
  ,    ,    
 (     TTbl),       
  Delphi,     .   
 , Delphi       . 

      
             bl,  
   Records     . 
        Delphi   
,    .     
  ,    Fields  TTbl    
 .          
         
 Records  . ,   , 
        . 

        Records,     3.5. 
         Delphi,  
  RegisterComponent.     
    ,      
.         
 ,    .    
      . 

     

           ,   
    Delphi.    . 
    Q .     ,  , 
   Delphi. 
    Q .        DLL, 
  Windows     . 
      .  Delphi  ,  , 
   ,    . 
    Q .      , 
   Delphi. 
    Q  .      
        . 
    Q .    ,    . 

     ... 

              
      .    
          
  ,    .   ,  
        ,  
          
   . 

    56  I.  
