1 | //kt -- Modified with SourceScanner on 7/24/2007
|
---|
2 | unit fNoteST;
|
---|
3 | {
|
---|
4 | Text Search CQ: HDS00002856
|
---|
5 | This Unit Contains the Dialog Used to Capture the Text that will be
|
---|
6 | searched for in the current notes view.
|
---|
7 | }
|
---|
8 |
|
---|
9 | interface
|
---|
10 |
|
---|
11 | uses
|
---|
12 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
13 | ExtCtrls, ORCtrls, StdCtrls, ORFn, uTIU, fAutoSz, DKLang;
|
---|
14 |
|
---|
15 | type
|
---|
16 | TfrmNotesSearchText = class(TfrmAutoSz)
|
---|
17 | lblSearchInfo: TLabel;
|
---|
18 | edtSearchText: TEdit;
|
---|
19 | lblAuthor: TLabel;
|
---|
20 | cmdOK: TButton;
|
---|
21 | cmdCancel: TButton;
|
---|
22 | DKLanguageController1: TDKLanguageController;
|
---|
23 | procedure cmdCancelClick(Sender: TObject);
|
---|
24 | procedure cmdOKClick(Sender: TObject);
|
---|
25 | procedure FormShow(Sender: TObject);
|
---|
26 | procedure FormDestroy(Sender: TObject);
|
---|
27 | procedure FormResize(Sender: TObject);
|
---|
28 | private
|
---|
29 | //kt Begin Mod (change Consts to Vars) 7/24/2007
|
---|
30 | TX_SEARCH_TEXT : string; //kt
|
---|
31 | TX_SEARCH_CAP : string; //kt
|
---|
32 | //kt End Mod -------------------
|
---|
33 | FChanged: Boolean;
|
---|
34 | FSearchString: string;
|
---|
35 | procedure SetupVars; //kt
|
---|
36 | end;
|
---|
37 |
|
---|
38 | TSearchContext = record
|
---|
39 | Changed: Boolean;
|
---|
40 | SearchString: string;
|
---|
41 | end;
|
---|
42 |
|
---|
43 | procedure SelectSearchText(FontSize: Integer; var SearchText: String; var SearchContext: TSearchContext);
|
---|
44 |
|
---|
45 | implementation
|
---|
46 |
|
---|
47 | {$R *.DFM}
|
---|
48 |
|
---|
49 | uses rTIU, rCore, uCore, rMisc;
|
---|
50 |
|
---|
51 | //const
|
---|
52 | //TX_SEARCH_TEXT = 'Select a search string or press Cancel.'; <-- original line. //kt 7/24/2007
|
---|
53 | //TX_SEARCH_CAP = 'Missing search string'; <-- original line. //kt 7/24/2007
|
---|
54 |
|
---|
55 | procedure TfrmNotesSearchText.SetupVars;
|
---|
56 | //kt Added entire function to replace constant declarations 7/24/2007
|
---|
57 | begin
|
---|
58 | TX_SEARCH_TEXT := DKLangConstW('fNoteST_Select_a_search_string_or_press_Cancelx');
|
---|
59 | TX_SEARCH_CAP := DKLangConstW('fNoteST_Missing_search_string');
|
---|
60 | end;
|
---|
61 |
|
---|
62 | procedure SelectSearchText(FontSize: Integer; var SearchText: String; var SearchContext: TSearchContext);
|
---|
63 | { displays author select form for progress notes and returns a record of the selection }
|
---|
64 | var
|
---|
65 | frmNotesSearchText: TfrmNotesSearchText;
|
---|
66 | W, H: integer;
|
---|
67 | // CurrentAuthor: Int64;
|
---|
68 | begin
|
---|
69 | frmNotesSearchText := TfrmNotesSearchText.Create(Application);
|
---|
70 | try
|
---|
71 | with frmNotesSearchText do
|
---|
72 | begin
|
---|
73 | edtSearchText.Text:=SearchText;
|
---|
74 | Font.Size := FontSize;
|
---|
75 | W := ClientWidth;
|
---|
76 | H := ClientHeight;
|
---|
77 | ResizeToFont(FontSize, W, H);
|
---|
78 | // ClientWidth := W; pnlBase.Width := W;
|
---|
79 | // ClientHeight := H; pnlBase.Height := W;
|
---|
80 | FChanged := False;
|
---|
81 | Show;
|
---|
82 | edtSearchText.SetFocus;
|
---|
83 | Hide;
|
---|
84 | ShowModal;
|
---|
85 | If edtSearchText.Text<>'' then
|
---|
86 | with SearchContext do
|
---|
87 | begin
|
---|
88 | Changed := FChanged;
|
---|
89 | SearchString := FSearchString;
|
---|
90 | end; {with SearchContext}
|
---|
91 | end; {with frmNotesSearchText}
|
---|
92 | finally
|
---|
93 | frmNotesSearchText.Release;
|
---|
94 | end;
|
---|
95 | end;
|
---|
96 |
|
---|
97 | procedure TfrmNotesSearchText.cmdCancelClick(Sender: TObject);
|
---|
98 | begin
|
---|
99 | FChanged:=False;
|
---|
100 | Close;
|
---|
101 | end;
|
---|
102 |
|
---|
103 | procedure TfrmNotesSearchText.cmdOKClick(Sender: TObject);
|
---|
104 | begin
|
---|
105 | SetupVars; //kt added 7/24/2007 to replace constants with vars.
|
---|
106 | if edtSearchText.Text = '' then
|
---|
107 | begin
|
---|
108 | InfoBox(TX_SEARCH_TEXT, TX_SEARCH_CAP, MB_OK or MB_ICONWARNING);
|
---|
109 | Exit;
|
---|
110 | end;
|
---|
111 | FChanged := True;
|
---|
112 | FSearchString := edtSearchText.Text;
|
---|
113 | Close;
|
---|
114 | end;
|
---|
115 |
|
---|
116 | procedure TfrmNotesSearchText.FormShow(Sender: TObject);
|
---|
117 | begin
|
---|
118 | SetFormPosition(Self);
|
---|
119 | end;
|
---|
120 |
|
---|
121 | procedure TfrmNotesSearchText.FormDestroy(Sender: TObject);
|
---|
122 | begin
|
---|
123 | SaveUserBounds(Self);
|
---|
124 | end;
|
---|
125 |
|
---|
126 | procedure TfrmNotesSearchText.FormResize(Sender: TObject);
|
---|
127 | begin
|
---|
128 | inherited;
|
---|
129 | lblSearchInfo.Width := edtSearchText.Width;
|
---|
130 | end;
|
---|
131 |
|
---|
132 | end.
|
---|