[800] | 1 | unit fImagePickPDF;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
| 7 | Dialogs, OleCtrls, SHDocVw, FileCtrl, StdCtrls, Buttons, ExtCtrls;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 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 |
|
---|
| 39 | var
|
---|
| 40 | frmImagePickPDF: TfrmImagePickPDF;
|
---|
| 41 |
|
---|
| 42 | implementation
|
---|
| 43 |
|
---|
| 44 | {$R *.dfm}
|
---|
| 45 |
|
---|
| 46 | uses 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 |
|
---|