source: cprs/branches/tmg-cprs/CPRS-Chart/fNoteST.pas@ 1156

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

Fixed crash on non-login

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