source: OniTrainer/current/Unit5.pas@ 369

Last change on this file since 369 was 251, checked in by alloc, 17 years ago
File size: 1.9 KB
RevLine 
[251]1UNIT Unit5;
2INTERFACE
3USES
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, StdCtrls, Unit8;
6TYPE
7 TForm5 = Class(TForm)
8 timer_edit: TEdit;
9 timer_label: TLabel;
10 timer_ok: TButton;
11 timer_cancel: TButton;
12 PROCEDURE OnShow(Sender: TObject);
13 PROCEDURE timer_okClick(Sender: TObject);
14 PROCEDURE timer_cancelClick(Sender: TObject);
15 PROCEDURE CloseQuery(Sender: TObject; var CanClose: Boolean);
16 PRIVATE
17 PUBLIC
18 END;
19VAR
20 Form5: TForm5;
21
22IMPLEMENTATION
23USES unit1, unit2, unit3;
24{$R *.dfm}
25
26PROCEDURE TForm5.CloseQuery(Sender: TObject; var CanClose: Boolean);
27 BEGIN
28 Self.Visible:=False;
29 Form1.Menu_FreezeTime.Enabled:=True;
30 Form1.Menu_RefreshTime.Enabled:=True;
31 CanClose:=False;
32 END;
33
34PROCEDURE TForm5.timer_cancelClick(Sender: TObject);
35 BEGIN
36 Form5.Close;
37 END;
38
39PROCEDURE TForm5.timer_okClick(Sender: TObject);
40 VAR time:Integer;
41 i:Byte;
42 BEGIN
43 IF TryStrToInt(Form5.timer_edit.Text,time) THEN BEGIN
44 IF (time>=50) AND (time<=10000) THEN BEGIN
45 IF Pos('FreezeTimer',Form5.Caption)>0 THEN BEGIN
46 FOR i:=0 TO ais_controlled DO BEGIN
47 CharForms[i].timer_freeze.Interval:=time;
48 END;
49 Form5.Close;
50 END ELSE BEGIN
51 Form1.get_values.Interval:=time;
52 FOR i:=0 TO ais_controlled DO BEGIN
53 CharForms[i].timer_actualize.Interval:=time;
54 END;
55 Form5.Close;
56 END;
57 END ELSE BEGIN
58 MessageBox(Form5.Handle,PChar('The value should be between 1 and 10000.'),PChar('Error'),MB_OK);
59 END;
60 END ELSE BEGIN
61 MessageBox(Form5.Handle,PChar('The value isn''t an integer.'),PChar('Error'),MB_OK);
62 END;
63 END;
64
65PROCEDURE TForm5.OnShow(Sender: TObject);
66 BEGIN
67 timer_edit.SelectAll;
68 timer_edit.SetFocus;
69 END;
70
71END.
Note: See TracBrowser for help on using the repository browser.