source: cprs/branches/foia-cprs/CPRS-Chart/fTimeout.pas@ 1676

Last change on this file since 1676 was 459, checked in by Kevin Toppenberg, 16 years ago

Adding foia-cprs branch

File size: 1.6 KB
Line 
1unit fTimeout;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fAutoSz, ExtCtrls, StdCtrls, ORFn;
8
9type
10 TfrmTimeout = class(TfrmAutoSz)
11 Label1: TStaticText;
12 Label2: TStaticText;
13 cmdContinue: TButton;
14 lblCount: TStaticText;
15 timCountDown: TTimer;
16 procedure FormCreate(Sender: TObject);
17 procedure cmdContinueClick(Sender: TObject);
18 procedure timCountDownTimer(Sender: TObject);
19 private
20 { Private declarations }
21 FContinue: Boolean;
22 FCount: Integer;
23 end;
24
25function AllowTimeout: Boolean;
26
27implementation
28
29{$R *.DFM}
30
31uses uCore;
32
33function AllowTimeout: Boolean;
34var
35 frmTimeout: TfrmTimeout;
36begin
37 frmTimeout := TfrmTimeout.Create(Application);
38 try
39 ResizeFormToFont(TForm(frmTimeout));
40 frmTimeout.ShowModal;
41 Result := not frmTimeout.FContinue;
42 finally
43 frmTimeout.Release;
44 end;
45end;
46
47procedure TfrmTimeout.FormCreate(Sender: TObject);
48begin
49 inherited;
50 MessageBeep(MB_ICONASTERISK);
51 FCount := User.CountDown;
52 lblCount.Caption := IntToStr(FCount);
53end;
54
55procedure TfrmTimeout.cmdContinueClick(Sender: TObject);
56begin
57 inherited;
58 FContinue := True;
59 Close;
60end;
61
62procedure TfrmTimeout.timCountDownTimer(Sender: TObject);
63begin
64 inherited;
65 if FCount = User.CountDown then
66 begin
67 MessageBeep(MB_ICONASTERISK);
68 timCountDown.Enabled := False;
69 timCountDown.Interval := 1000;
70 timCountDown.Enabled := True;
71 end;
72 Dec(FCount);
73 lblCount.Caption := IntToStr(FCount);
74 if FCount = 0 then
75 begin
76 timCountDown.Enabled := False;
77 Close;
78 end;
79end;
80
81end.
Note: See TracBrowser for help on using the repository browser.