home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programming Unleashed / Delphi_Programming_Unleashed_SAMS_Publishing_1995.iso / chap28 / object4 / reports.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-03-21  |  1.6 KB  |  81 lines

  1. unit Reports;
  2.  
  3. { Program copyright (c) 1995 by Charles Calvert }
  4. { Project Name: OBJECT4 }
  5.  
  6. interface
  7.  
  8. uses
  9.   SysUtils, WinTypes, WinProcs,
  10.   Messages, Classes, Graphics,
  11.   Controls, Forms, Dialogs,
  12.   StdCtrls, ExtCtrls, ClassDef, Buttons;
  13.  
  14. type
  15.   TReport = class(TForm)
  16.     Panel1: TPanel;
  17.     LName: TLabel;
  18.     Panel2: TPanel;
  19.     LPanel: TLabel;
  20.     LPalette: TLabel;
  21.     Label2: TLabel;
  22.     Label3: TLabel;
  23.     Label4: TLabel;
  24.     LDescription: TLabel;
  25.     Label5: TLabel;
  26.     LQuantity: TLabel;
  27.     BitBtn1: TBitBtn;
  28.     StockItems: TBitBtn;
  29.     BitBtn2: TBitBtn;
  30.     procedure BitBtn1Click(Sender: TObject);
  31.     procedure StockItemsClick(Sender: TObject);
  32.     procedure BitBtn2Click(Sender: TObject);
  33.   private
  34.     FWidget: TWidget;
  35.     procedure ShowData;
  36.   public
  37.     procedure Run(Widget: TWidget);
  38.   end;
  39.  
  40. var
  41.   Report: TReport;
  42.  
  43. implementation
  44.  
  45. {$R *.DFM}
  46.  
  47. procedure TReport.ShowData;
  48. begin
  49.   LName.Caption := FWidget.GetName;
  50.   LPalette.Caption := IntToStr(FWidget.Twin.Tag);
  51.   LPanel.Caption := TPanel(FWidget.Parent).Name;
  52.   LDescription.Caption := FWidget.Description;
  53.   LQuantity.Caption := IntToStr(FWidget.Quantity);
  54. end;
  55.  
  56. procedure TReport.Run(Widget: TWidget);
  57. begin
  58.   FWidget := Widget;
  59.   ShowData;
  60.   ShowModal;
  61. end;
  62.  
  63. procedure TReport.BitBtn1Click(Sender: TObject);
  64. begin
  65.   Close;
  66. end;
  67.  
  68. procedure TReport.StockItemsClick(Sender: TObject);
  69. begin
  70.   FWidget.Stock;
  71.   ShowData;
  72. end;
  73.  
  74. procedure TReport.BitBtn2Click(Sender: TObject);
  75. begin
  76.   FWidget.ShowHierarchy;
  77.   ModalResult := mrNone;
  78. end;
  79.  
  80. end.
  81.