PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/Source/FR_PROGR.PAS

http://github.com/FastReports/FreeReport
Pascal | 99 lines | 58 code | 16 blank | 25 comment | 2 complexity | 20fa9a08a663f0fe65a67b19a529b190 MD5 | raw file
 1
 2{*****************************************}
 3{                                         }
 4{             FastReport v2.3             }
 5{             Progress dialog             }
 6{                                         }
 7{  Copyright (c) 1998-99 by Tzyganenko A. }
 8{                                         }
 9{*****************************************}
10
11unit FR_progr;
12
13interface
14
15{$I FR.inc}
16
17uses
18  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
19  StdCtrls, ExtCtrls, FR_Class, FR_Const;
20
21const
22  CM_BeforeModal = WM_USER + 1;
23
24type
25  TfrProgressForm = class(TForm)
26    Button1: TButton;
27    Label1: TLabel;
28    procedure Button1Click(Sender: TObject);
29    procedure FormCreate(Sender: TObject);
30  private
31    { Private declarations }
32    FDoc: TfrReport;
33    FOnBeforeModal: TNotifyEvent;
34{$IFDEF Delphi9}
35    procedure CMBeforeModal(Sender: TObject);
36{$ELSE}
37    procedure CMBeforeModal(var Message: TMessage); message CM_BeforeModal;
38{$ENDIF}
39  public
40    { Public declarations }
41    FirstCaption: String;
42{$IFDEF Delphi9}
43    Timer: TTimer;
44{$ENDIF}
45    property OnBeforeModal: TNotifyEvent read FOnBeforeModal write FOnBeforeModal;
46    function Show_Modal(Doc: TfrReport): Word;
47  end;
48
49var
50  frProgressForm: TfrProgressForm;
51
52implementation
53
54{$R *.DFM}
55
56function TfrProgressForm.Show_Modal(Doc: TfrReport): Word;
57begin
58  FDoc := Doc;
59{$IFDEF Delphi9}
60  Timer := TTimer.Create(nil);
61  Timer.Interval := 200;
62  Timer.OnTimer := CMBeforeModal;
63  Timer.Enabled := True;
64{$ELSE}
65  PostMessage(Handle, CM_BeforeModal, 0, 0);
66{$ENDIF}
67  Result := ShowModal;
68{$IFDEF Delphi9}
69  Timer.Free;
70{$ENDIF}
71end;
72
73procedure TfrProgressForm.Button1Click(Sender: TObject);
74begin
75  FDoc.Terminated := True;
76  ModalResult := mrCancel;
77end;
78
79{$IFDEF Delphi9}
80procedure TfrProgressForm.CMBeforeModal(Sender: TObject);
81begin
82  Timer.Enabled := False;
83  if Assigned(FOnBeforeModal) then
84    FOnBeforeModal(Self);
85end;
86{$ELSE}
87procedure TfrProgressForm.CMBeforeModal(var Message: TMessage);
88begin
89  if Assigned(FOnBeforeModal) then FOnBeforeModal(Self);
90end;
91{$ENDIF}
92
93procedure TfrProgressForm.FormCreate(Sender: TObject);
94begin
95  Button1.Caption := LoadStr(SCancel);
96end;
97
98end.
99