-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWizard.pas
208 lines (187 loc) · 5.43 KB
/
Wizard.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
UNIT Wizard;
// ============================================================================
INTERFACE
USES
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls;
type
TfrmWizard = class(TForm)
pnlWizard: TPanel;
Image1: TImage;
pgWizard: TPageControl;
tsPage1: TTabSheet;
Label1: TLabel;
Label2: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
tsPage2: TTabSheet;
Label14: TLabel;
Label15: TLabel;
rgWizDisplayMode: TRadioGroup;
cbWizPrinters: TComboBox;
tsPage3: TTabSheet;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
tsPage4: TTabSheet;
Label16: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
rgWizColumns: TRadioGroup;
cbWizFontName: TCheckBox;
tsPage5: TTabSheet;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
Label43: TLabel;
cbWizTitle: TCheckBox;
eWizTitleText: TEdit;
cbWizDateTime: TCheckBox;
cbWizPageNo: TCheckBox;
tsPage6: TTabSheet;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
bPrev: TButton;
bNext: TButton;
bFinish: TButton;
mWizMessage: TMemo;
procedure bNextClick(Sender: TObject);
procedure bPrevClick(Sender: TObject);
procedure bFinishClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cbWizTitleClick(Sender: TObject);
procedure rgWizDisplayModeClick(Sender: TObject);
private
procedure ProcessWizPage;
public
end;
// ============================================================================
IMPLEMENTATION
USES
Main;
{$R *.DFM}
//------------------------------------------------------------------------------
procedure TfrmWizard.bNextClick(Sender: TObject);
begin
ProcessWizPage;
if pgWizard.ActivePage = tsPage1 then
begin
bPrev.Enabled := True;
pgWizard.ActivePage := tsPage2
end
else if pgWizard.ActivePage = tsPage2 then
pgWizard.ActivePage := tsPage3
else if pgWizard.ActivePage = tsPage3 then
pgWizard.ActivePage := tsPage4
else if pgWizard.ActivePage = tsPage4 then
pgWizard.ActivePage := tsPage5
else if pgWizard.ActivePage = tsPage5 then
begin
bNext.Enabled := False;
pgWizard.ActivePage := tsPage6
end
end;
//------------------------------------------------------------------------------
procedure TfrmWizard.ProcessWizPage;
begin
if pgWizard.ActivePage = tsPage2 then
begin
if rgWizDisplayMode.ItemIndex = 1 then
frmAdvanced.cbPrinters.ItemIndex := cbWizPrinters.ItemIndex
end
else if pgWizard.ActivePage = tsPage3 then
begin
frmAdvanced.mMessage.Text := mWizMessage.Text
end
else if pgWizard.ActivePage = tsPage4 then
begin
frmAdvanced.rgColumns.ItemIndex := rgWizColumns.ItemIndex;
frmAdvanced.cbFontName.Checked := cbWizFontName.Checked
end
else if pgWizard.ActivePage = tsPage5 then
begin
frmAdvanced.cbTitle.Checked := cbWizTitle.Checked;
frmAdvanced.eTitleText.Text := eWizTitleText.Text;
frmAdvanced.cbDateTime.Checked := cbWizDateTime.Checked;
frmAdvanced.cbPageNo.Checked := cbWizPageNo.Checked
end
end;
//------------------------------------------------------------------------------
procedure TfrmWizard.bPrevClick(Sender: TObject);
begin
ProcessWizPage;
if pgWizard.ActivePage = tsPage2 then
begin
bPrev.Enabled := False;
pgWizard.ActivePage := tsPage1
end
else if pgWizard.ActivePage = tsPage3 then
pgWizard.ActivePage := tsPage2
else if pgWizard.ActivePage = tsPage4 then
pgWizard.ActivePage := tsPage3
else if pgWizard.ActivePage = tsPage5 then
pgWizard.ActivePage := tsPage4
else if pgWizard.ActivePage = tsPage6 then
begin
bNext.Enabled := True;
pgWizard.ActivePage := tsPage5
end
end;
//------------------------------------------------------------------------------
procedure TfrmWizard.bFinishClick(Sender: TObject);
begin
ProcessWizPage;
if rgWizDisplayMode.ItemIndex = 0 then
frmMain.bPreviewClick (Sender)
else
frmMain.bPrintClick (Sender)
end;
//------------------------------------------------------------------------------
procedure TfrmWizard.FormCreate(Sender: TObject);
var
i: integer;
tmpTab: TTabSheet;
begin
for i := 0 to pgWizard.PageCount - 1 do
if (pgWizard.Pages [i] is TTabSheet) then
begin
tmpTab := pgWizard.Pages [i] as TTabSheet;
tmpTab.TabVisible := False
end
end;
//------------------------------------------------------------------------------
procedure TfrmWizard.cbWizTitleClick(Sender: TObject);
begin
eWizTitleText.Enabled := cbWizTitle.Checked
end;
//------------------------------------------------------------------------------
procedure TfrmWizard.rgWizDisplayModeClick(Sender: TObject);
begin
if rgWizDisplayMode.ItemIndex = 0 then
cbWizPrinters.Enabled := False
else
cbWizPrinters.Enabled := True
end;
END.