home *** CD-ROM | disk | FTP | other *** search
- unit Repmain;
-
- interface
-
- uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
- StdCtrls, ExtCtrls, Dialogs, PrnFile, CB_Types, RepDem01,
- RepDem02, RepDem03, RepDem04, RepDem05, RepDem06, RepDem07, RepDem08,
- CB_MFunc;
-
- type
- TMainReport = class(TForm)
- Label1: TLabel;
- Panel1: TPanel;
- Bevel1: TBevel;
- ListBox1: TListBox;
- View: TButton;
- Exit: TButton;
- Printer: TButton;
- PrinterSetupDialog1: TPrinterSetupDialog;
- Printit: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- OpenDialog1: TOpenDialog;
- PrintFile1: TPrintFile;
- procedure ExitClick(Sender: TObject);
- procedure ViewClick(Sender: TObject);
- procedure PrinterClick(Sender: TObject);
- procedure ListBox1DblClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- MainReport: TMainReport;
-
- implementation
-
- {$R *.DFM}
-
- procedure TMainReport.ExitClick(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TMainReport.ViewClick(Sender: TObject);
- var
- OpenDialog1: TOpenDialog;
-
- begin
- if ListBox1.ItemIndex < 0 then
- MessageDlg('Please select an option from the List Box', mtInformation,
- [mbOk], 0);
-
- if (ListBox1.ItemIndex >= 0) then begin
- case ListBox1.ItemIndex of
- 0: begin
- dem01form := Tdem01form.Create (Application);
- dem01form.ShowModal;
- dem01form.Free;
- end;
- 1: begin
- dem02form := Tdem02form.Create (Application);
- dem02form.ShowModal;
- dem02form.Free;
- end;
- 2: begin
- dem03form := Tdem03form.Create (Application);
- dem03form.ShowModal;
- dem03form.Free;
- end;
- 3: begin
- dem04form := Tdem04form.Create (Application);
- dem04form.ShowModal;
- dem04form.Free;
- end;
- 4: begin
- dem05form := Tdem05form.Create (Application);
- dem05form.ShowModal;
- dem05form.Free;
- end;
- 5: begin
- dem08form := Tdem08form.Create (Application);
- dem08form.ShowModal;
- dem08form.Free;
- end;
- 6: begin
- dem06form := Tdem06form.Create (Application);
- dem06form.ShowModal;
- dem06form.Free;
- end;
- 7: begin
- dem07form := Tdem07form.Create (Application);
- dem07form.ShowModal;
- dem07form.Free;
- end;
-
-
- 8: begin
- OpenDialog1 := TOpenDialog.Create(Application);
- OpenDialog1.Filter := 'Text files (*.TXT)|*.TXT|Pascal files (*.PAS)' +
- '|*.PAS|Quattro Pro files (*.WB1)|*.WB1|All Files (*.*)|*.*';
-
- OpenDialog1.FileName := '';
- if OpenDialog1.Execute then begin
- PrintFile1.Filename := OpenDialog1.FileName;
- PrintFile1.PageLayout := pl_1x2;
- PrintFile1.HeaderStringCenter := OpenDialog1.FileName;
- PrintFile1.Execute;
- end;
- OpenDialog1.Free;
- end;
- 9: begin
- OpenDialog1 := TOpenDialog.Create(Application);
- OpenDialog1.Filter := 'Text files (*.TXT)|*.TXT|Pascal files (*.PAS)' +
- '|*.PAS|Quattro Pro files (*.WB1)|*.WB1|All Files (*.*)|*.*';
-
- OpenDialog1.FileName := '';
- if OpenDialog1.Execute then begin
- PrintFile1.Filename := OpenDialog1.FileName;
- PrintFile1.PageLayout := pl_1x3;
- PrintFile1.HeaderStringCenter := OpenDialog1.FileName;
- PrintFile1.Execute;
- end;
- OpenDialog1.Free;
- end;
- 10: begin
- PrintFile1.Input := frHTML;
- OpenDialog1 := TOpenDialog.Create(Application);
- OpenDialog1.Filter := 'HTML files (*.HTM)|*.HTM';
-
- OpenDialog1.FileName := '';
- if OpenDialog1.Execute then begin
- PrintFile1.Filename := OpenDialog1.FileName;
- PrintFile1.PageLayout := pl_1x2;
- PrintFile1.HeaderStringCenter := OpenDialog1.FileName;
- PrintFile1.Execute;
- end;
- OpenDialog1.Free;
- PrintFile1.Input := frFile;
- end;
- 11: begin
- PrintFile1.Input := frHTML;
- OpenDialog1 := TOpenDialog.Create(Application);
- OpenDialog1.Filter := 'HTML files (*.HTM)|*.HTM';
-
- OpenDialog1.FileName := '';
- if OpenDialog1.Execute then begin
- PrintFile1.Filename := OpenDialog1.FileName;
- PrintFile1.PageLayout := pl_1x3;
- PrintFile1.HeaderStringCenter := OpenDialog1.FileName;
- PrintFile1.Execute;
- end;
- PrintFile1.Input := frFile;
- OpenDialog1.Free;
- end;
-
- end;
- end;
- end;
-
- procedure TMainReport.PrinterClick(Sender: TObject);
- begin
- PrinterSetupDialog1.Execute;
- end;
-
- procedure TMainReport.ListBox1DblClick(Sender: TObject);
- begin
- ViewClick(Sender);
- end;
-
- end.
-