Rev 76 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
75 | daniel-mar | 1 | unit MAIN; |
2 | |||
3 | // TODO: Wenn man das Hauptfenster schließt, sollen nicht alle Uhren meckern |
||
4 | // TODO: Uhrzeiten abspeichern? |
||
5 | // TODO: Uhrzeitenwert manuell änderbar machen? |
||
6 | // TODO: Automatische Fenster-Anordnung funktioniert nicht korrekt mit poDefaultSizeOnly |
||
7 | |||
8 | interface |
||
9 | |||
10 | uses Windows, SysUtils, Classes, Graphics, Forms, Controls, Menus, |
||
11 | StdCtrls, Dialogs, Buttons, Messages, ExtCtrls, ComCtrls, StdActns, |
||
12 | ActnList, ToolWin, ImgList; |
||
13 | |||
14 | type |
||
15 | TMainForm = class(TForm) |
||
16 | MainMenu1: TMainMenu; |
||
17 | File1: TMenuItem; |
||
18 | FileNewItem: TMenuItem; |
||
19 | FileCloseItem: TMenuItem; |
||
20 | Window1: TMenuItem; |
||
21 | Help1: TMenuItem; |
||
22 | N1: TMenuItem; |
||
23 | FileExitItem: TMenuItem; |
||
24 | WindowCascadeItem: TMenuItem; |
||
25 | WindowTileItem: TMenuItem; |
||
26 | WindowArrangeItem: TMenuItem; |
||
27 | HelpAboutItem: TMenuItem; |
||
28 | OpenDialog: TOpenDialog; |
||
29 | WindowMinimizeItem: TMenuItem; |
||
30 | StatusBar: TStatusBar; |
||
31 | ActionList1: TActionList; |
||
32 | FileNew1: TAction; |
||
33 | FileExit1: TAction; |
||
34 | WindowCascade1: TWindowCascade; |
||
35 | WindowTileHorizontal1: TWindowTileHorizontal; |
||
36 | WindowArrangeAll1: TWindowArrange; |
||
37 | WindowMinimizeAll1: TWindowMinimizeAll; |
||
38 | HelpAbout1: TAction; |
||
39 | FileClose1: TWindowClose; |
||
40 | WindowTileVertical1: TWindowTileVertical; |
||
41 | WindowTileItem2: TMenuItem; |
||
42 | ToolBar2: TToolBar; |
||
43 | ToolButton9: TToolButton; |
||
44 | ToolButton8: TToolButton; |
||
45 | ToolButton10: TToolButton; |
||
46 | ToolButton11: TToolButton; |
||
47 | ImageList1: TImageList; |
||
48 | procedure FileNew1Execute(Sender: TObject); |
||
49 | procedure FileOpen1Execute(Sender: TObject); |
||
50 | procedure HelpAbout1Execute(Sender: TObject); |
||
51 | procedure FileExit1Execute(Sender: TObject); |
||
52 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
||
53 | private |
||
54 | { Private-Deklarationen } |
||
55 | procedure CreateMDIChild(const Name: string); |
||
56 | public |
||
57 | { Public-Deklarationen } |
||
58 | end; |
||
59 | |||
60 | var |
||
61 | MainForm: TMainForm; |
||
62 | |||
63 | implementation |
||
64 | |||
65 | {$R *.dfm} |
||
66 | |||
67 | uses CHILDWIN, about; |
||
68 | |||
69 | var |
||
70 | StopUhrCount: integer = 1; |
||
71 | |||
72 | procedure TMainForm.CreateMDIChild(const Name: string); |
||
73 | var |
||
74 | Child: TMDIChild; |
||
75 | begin |
||
76 | Child := TMDIChild.Create(Application); |
||
77 | Child.Caption := Name; |
||
78 | Child.Memo1.Lines.Text := Name; |
||
79 | end; |
||
80 | |||
81 | procedure TMainForm.FileNew1Execute(Sender: TObject); |
||
82 | begin |
||
83 | CreateMDIChild('Stoppuhr #' + IntToStr(StopUhrCount)); |
||
84 | Inc(StopUhrCount); |
||
85 | end; |
||
86 | |||
87 | procedure TMainForm.FileOpen1Execute(Sender: TObject); |
||
88 | begin |
||
89 | if OpenDialog.Execute then |
||
90 | CreateMDIChild(OpenDialog.FileName); |
||
91 | end; |
||
92 | |||
93 | procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
||
94 | begin |
||
95 | // Brauchen wir nicht, da die einzelnen MDI-Fenster ja schon meckern |
||
96 | //CanClose := MessageDlg('Programm wirklich beenden?', mtConfirmation, mbYesNoCancel, 0) = mrYes; |
||
97 | end; |
||
98 | |||
99 | procedure TMainForm.HelpAbout1Execute(Sender: TObject); |
||
100 | begin |
||
101 | AboutBox.ShowModal; |
||
102 | end; |
||
103 | |||
104 | procedure TMainForm.FileExit1Execute(Sender: TObject); |
||
105 | begin |
||
106 | Close; |
||
107 | end; |
||
108 | |||
109 | end. |