-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathPDFium.SearchDlg.pas
63 lines (51 loc) · 1.32 KB
/
PDFium.SearchDlg.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
unit PDFium.SearchDlg;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TSearchDlg = class(TForm)
edSearch: TEdit;
btPrev: TButton;
btNext: TButton;
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure btNextClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
class procedure Execute(Sender: TComponent);
end;
var
SearchDlg: TSearchDlg;
implementation
{$R *.dfm}
uses PDFium.Frame;
procedure TSearchDlg.btNextClick(Sender: TObject);
begin
if not TPDFiumFrame(Owner).Search(edSearch.Text, Sender = btNext) then
ShowMessage('Text not found');
end;
class procedure TSearchDlg.Execute(Sender: TComponent);
begin
if SearchDlg = nil then
SearchDlg := TSearchDlg.Create(Sender)
else
SearchDlg.Show;
end;
procedure TSearchDlg.FormDestroy(Sender: TObject);
begin
SearchDlg := nil;
end;
procedure TSearchDlg.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case Key of
VK_ESCAPE:
Close;
VK_RETURN:
btNextClick(btNext);
end;
end;
end.