home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1998 October / dpcb1098.iso / Business / Maxim / MAX5 / data.z / MAIN.PAS < prev    next >
Pascal/Delphi Source File  |  1998-05-13  |  2KB  |  69 lines

  1. unit main;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls, DB, DBTables, Report, ExtCtrls, Buttons;
  8.  
  9. type
  10.   TMainForm = class(TForm)
  11.     Report: TReport;
  12.     Query1: TQuery;
  13.     Rgrp_State: TRadioGroup;
  14.     Rgrp_Mode: TRadioGroup;
  15.     Btn_Run: TBitBtn;
  16.     procedure Btn_RunClick(Sender: TObject);
  17.     procedure FormCreate(Sender: TObject);
  18.     procedure Rgrp_StateClick(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.   end;
  24.  
  25. var
  26.   MainForm: TMainForm;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. procedure TMainForm.Btn_RunClick(Sender: TObject);
  33. begin
  34.   If RGrp_Mode.ItemIndex = 1 then
  35.     begin
  36.      Report.Preview := False;
  37.      Report.AutoUnload := True;
  38.      Query1.ParamByName('ST').AsString := Rgrp_State.Items[Rgrp_State.Itemindex];
  39.      Query1.Open;
  40.      Report.Run;
  41.     end
  42.   else
  43.     begin
  44.      Report.Preview := True;
  45.      Report.AutoUnload := False;
  46.      Query1.ParamByName('ST').AsString := Rgrp_State.Items[Rgrp_State.Itemindex];
  47.      Report.run;
  48.    end;
  49. end;
  50.  
  51. procedure TMainForm.FormCreate(Sender: TObject);
  52. begin
  53.   MainForm.height := 114;
  54.   MainForm.width := 314;
  55.   Query1.ParamByName('ST').AsString := 'HI';
  56.   Report.ReportDir := ExtractFilePath(Application.ExeName);
  57.   end;
  58.  
  59. procedure TMainForm.Rgrp_StateClick(Sender: TObject);
  60. begin
  61.   Query1.ParamByName('ST').AsString :=
  62.     Rgrp_State.Items[Rgrp_State.Itemindex];
  63.   Query1.Open;
  64.   If FindWindowEx(0,0,nil,'RS_Runtime') <> 0 then
  65.     Report.RecalcReport;
  66. end;
  67.  
  68. end.
  69.