home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 February / Chip_2004-02_cd1.bin / program / delphi / navody / d56 / ec1vr2.exe / #setuppath# / Delphi / AddrLabs / Main.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2003-12-09  |  2.1 KB  |  91 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   vivrep20, Menus, Grids, DBGrids, StdCtrls, Buttons, ExtCtrls, Db,
  8.   DBTables, ImgList, ActnList, ComCtrls, ToolWin;
  9.  
  10. type
  11.   TMainForm = class(TForm)
  12.     MainMenu: TMainMenu;
  13.     FilePrintItem: TMenuItem;
  14.     FilePrintSetupItem: TMenuItem;
  15.     FileExitItem: TMenuItem;
  16.     HelpAboutItem: TMenuItem;
  17.     Preview: TMenuItem;
  18.     ImageList: TImageList;
  19.     ActionList: TActionList;
  20.     ExitAction: TAction;
  21.     PrintSetupAction: TAction;
  22.     PrintAction: TAction;
  23.     PrintPreviewAction: TAction;
  24.     AboutAction: TAction;
  25.     ToolBar1: TToolBar;
  26.     ToolButton1: TToolButton;
  27.     ToolButton2: TToolButton;
  28.     ToolButton3: TToolButton;
  29.     ToolButton4: TToolButton;
  30.     ToolButton5: TToolButton;
  31.     ToolButton6: TToolButton;
  32.     ToolButton7: TToolButton;
  33.     TargetsPanel: TPanel;
  34.     TargetsGrid: TDBGrid;
  35.     TargetsTable: TTable;
  36.     TargetsSource: TDataSource;
  37.  
  38.     procedure ExitActionExecute(Sender: TObject);
  39.     procedure AboutActionExecute(Sender: TObject);
  40.     procedure PrintSetupActionExecute(Sender: TObject);
  41.     procedure PrintActionExecute(Sender: TObject);  
  42.     procedure PrintPreviewActionExecute(Sender: TObject);
  43.   private
  44.     { Private declarations }
  45.   public
  46.     { Public declarations }
  47.     constructor Create (AOwner: TComponent); override;
  48.   end;
  49.  
  50. var
  51.   MainForm: TMainForm;
  52.  
  53. implementation
  54.  
  55. uses Rep, About;
  56.  
  57. {$R *.DFM}
  58.  
  59. constructor TMainForm.Create (AOwner: TComponent);
  60. begin
  61.   inherited Create (AOwner);
  62.   TargetsTable.Active:= true;
  63. end;
  64.  
  65. procedure TMainForm.ExitActionExecute(Sender: TObject);
  66. begin
  67.   Close;
  68. end;
  69.  
  70. procedure TMainForm.AboutActionExecute(Sender: TObject);
  71. begin
  72.   AboutBox.ShowModal;
  73. end;
  74.  
  75. procedure TMainForm.PrintSetupActionExecute(Sender: TObject);
  76. begin
  77.   RepForm.VividReport.PrinterSetup;
  78. end;
  79.  
  80. procedure TMainForm.PrintActionExecute(Sender: TObject);  
  81. begin
  82.   if RepForm.VividReport.PrintSetup then RepForm.VividReport.Print;
  83. end;
  84.  
  85. procedure TMainForm.PrintPreviewActionExecute(Sender: TObject);
  86. begin
  87.   RepForm.VividReport.PrintPreview (RepForm.VRPreview);
  88. end;
  89.  
  90. end.
  91.