home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE10 / CONSTRUC / INFOFORM.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-05-05  |  2.4 KB  |  99 lines

  1. unit Infoform;
  2. interface
  3. uses
  4. {$IFDEF WIN32}
  5.   Windows,
  6. {$ELSE}
  7.   WinTypes, WinProcs,
  8. {$ENDIF}
  9.   SysUtils, Messages, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls,
  10.   StdCtrls, Buttons, Grids;
  11.  
  12. Type
  13.   TInformationFrm = class(TForm)
  14.     Panel1: TPanel;
  15.     Image1: TImage;
  16.     Label1: TLabel;
  17.     Label2: TLabel;
  18.     Label3: TLabel;
  19.     Label4: TLabel;
  20.     StringGrid1: TStringGrid;
  21.     BitBtn1: TBitBtn;
  22.     BitBtn2: TBitBtn;
  23.     procedure FormActivate(Sender: TObject);
  24.     procedure CheckOut(Sender: TObject);
  25.   end;
  26.  
  27. {$IFDEF WIN32}
  28. Var
  29. {$ELSE}
  30. Const
  31. {$ENDIF}
  32.   InformationFrm: TInformationFrm = nil;
  33.  
  34. implementation
  35. uses ExptIntf;
  36.  
  37. {$R *.DFM}
  38.  
  39. procedure TInformationFrm.FormActivate(Sender: TObject);
  40. var FormCount,UnitCount,i,j: Integer;
  41.     FormName,UnitName: String;
  42. begin
  43.   StringGrid1.RowCount := 10;
  44.   StringGrid1.Cells[0,0] := 'units: 0';
  45.   StringGrid1.Cells[1,0] := 'forms: 0';
  46.   if ToolServices <> nil then
  47.   begin
  48.     FormCount := ToolServices.GetFormCount;
  49.     UnitCount := ToolServices.GetUnitCount;
  50.     if UnitCount >= StringGrid1.RowCount then
  51.       StringGrid1.RowCount := Succ(Succ(UnitCount));
  52.     FormName := ToolServices.GetProjectName
  53.   end
  54.   else
  55.   begin
  56.     FormCount := 0;
  57.     UnitCount := -1;
  58.     FormName := ''
  59.   end;
  60.   StringGrid1.Cells[1,0] := Format('forms: %d',[FormCount]);
  61.   Label3.Caption := ExtractFileName(FormName);
  62.   Label4.Caption := FormName;
  63. {$IFDEF WIN32}
  64.   StringGrid1.Cells[0,0] := Format('units: %d',[UnitCount-1]);
  65.   for i:=1 to Pred(UnitCount) do
  66. {$ELSE}
  67.   StringGrid1.Cells[0,0] := Format('units: %d',[UnitCount+1]);
  68.   for i:=0 to UnitCount do
  69. {$ENDIF}
  70.   begin
  71.     UnitName := ToolServices.GetUnitName(i);
  72.     UnitName := UpperCase(ExtractFileName(UnitName));
  73.     StringGrid1.Cells[0,i+1] := UnitName;
  74.     if (Pos('.PAS',UnitName) > 0) then
  75.     begin
  76.       j := 0;
  77.       repeat
  78.         FormName := ToolServices.GetFormName(j);
  79.         FormName := UpperCase(ExtractFileName(FormName));
  80.         if FormName = ChangeFileExt(UnitName,'.DFM') then
  81.         begin
  82.           StringGrid1.Cells[1,i+1] := FormName;
  83.           j := FormCount
  84.         end
  85.         else Inc(j)
  86.       until j >= FormCount
  87.     end
  88.     else
  89.       StringGrid1.Cells[1,i+1] := '-'
  90.   end
  91. end;
  92.  
  93. procedure TInformationFrm.CheckOut(Sender: TObject);
  94. begin
  95.   { CheckOutViCiouS(StringGrid1.Row) }
  96. end;
  97.  
  98. end.
  99.