source: cprs/trunk/CPRS-Chart/fNoteST.pas@ 1068

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

Upgrading to version 27

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