source: cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fImagePickPDF.pas@ 1536

Last change on this file since 1536 was 800, checked in by Kevin Toppenberg, 14 years ago

Fixing uploads of PDF files

File size: 2.6 KB
RevLine 
[800]1unit fImagePickPDF;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, OleCtrls, SHDocVw, FileCtrl, StdCtrls, Buttons, ExtCtrls;
8
9type
10 TfrmImagePickPDF = class(TForm)
11 pnlTop: TPanel;
12 UDSplitter: TSplitter;
13 pnlBottom: TPanel;
14 pnlTopLeft: TPanel;
15 LRSplitter: TSplitter;
16 pnlTopRight: TPanel;
17 DriveComboBox: TDriveComboBox;
18 DirectoryListBox: TDirectoryListBox;
19 FileListBox: TFileListBox;
20 pnlButtons: TPanel;
21 btnOK: TBitBtn;
22 btnCancel: TBitBtn;
23 FilterComboBox: TFilterComboBox;
24 WebBrowser: TWebBrowser;
25 procedure FileListBoxChange(Sender: TObject);
26 procedure FormShow(Sender: TObject);
27 procedure FormHide(Sender: TObject);
28 private
29 { Private declarations }
30 public
31 { Public declarations }
32 Filename : string;
33 Files : TStringList;
34 function Execute : boolean;
35 constructor Create(AOwner : TComponent); override;
36 destructor Destroy; override;
37 end;
38
39var
40 frmImagePickPDF: TfrmImagePickPDF;
41
42implementation
43
44{$R *.dfm}
45
46uses fImages, StrUtils;
47
48
49 function TfrmImagePickPDF.Execute : boolean;
50 var i : integer;
51 OneFile : string;
52 begin
53 Files.Clear;
54 Result := (self.ShowModal = mrOK);
55 if FileListBox.FileName = '' then Result := false;
56 for i := 0 to FileListBox.Count-1 do begin
57 if not FileListBox.Selected[i] then continue;
58 OneFile := DirectoryListBox.Directory;
59 if RightStr(OneFile,1) <> '\' then OneFile := OneFile + '\';
60 Onefile := OneFile + FileListBox.Items.Strings[i];
61 Files.Add(OneFile);
62 end;
63 if Files.IndexOf(FileListBox.FileName)<0 then begin
64 Files.Add(FileListBox.FileName);
65 end;
66 end;
67
68 procedure TfrmImagePickPDF.FileListBoxChange(Sender: TObject);
69 var FName : string;
70 begin
71 Filename := FileListBox.FileName;
72 if FileListBox.FileName <> '' then begin
73 FName := FileListBox.FileName;
74 end else begin
75 FName := frmImages.NullImageName
76 end;
77 WebBrowser.Navigate(FName);
78 end;
79
80 procedure TfrmImagePickPDF.FormShow(Sender: TObject);
81 begin
82 WebBrowser.Navigate(frmImages.NullImageName);
83 end;
84
85 procedure TfrmImagePickPDF.FormHide(Sender: TObject);
86 begin
87 WebBrowser.Navigate(frmImages.NullImageName);
88 end;
89
90 constructor TfrmImagePickPDF.Create(AOwner : TComponent);
91 begin
92 inherited Create(AOwner);
93 Files := TStringList.Create;
94 end;
95
96 destructor TfrmImagePickPDF.Destroy;
97 begin
98 Files.Free;
99 inherited Destroy;
100 end;
101
102 end.
103
Note: See TracBrowser for help on using the repository browser.