[453] | 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 | 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 |
|
---|
| 42 | procedure SelectSearchText(FontSize: Integer; var SearchText: String; var SearchContext: TSearchContext);
|
---|
| 43 |
|
---|
| 44 | implementation
|
---|
| 45 |
|
---|
| 46 | {$R *.DFM}
|
---|
| 47 |
|
---|
| 48 | uses 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 |
|
---|
| 54 | procedure TfrmNotesSearchText.SetupVars;
|
---|
| 55 | //kt Added entire function to replace constant declarations 7/24/2007
|
---|
| 56 | begin
|
---|
| 57 | TX_SEARCH_TEXT := DKLangConstW('fNoteST_Select_a_search_string_or_press_Cancelx');
|
---|
| 58 | TX_SEARCH_CAP := DKLangConstW('fNoteST_Missing_search_string');
|
---|
| 59 | end;
|
---|
| 60 |
|
---|
| 61 | procedure SelectSearchText(FontSize: Integer; var SearchText: String; var SearchContext: TSearchContext);
|
---|
| 62 | { displays author select form for progress notes and returns a record of the selection }
|
---|
| 63 | var
|
---|
| 64 | frmNotesSearchText: TfrmNotesSearchText;
|
---|
| 65 | W, H: integer;
|
---|
| 66 | // CurrentAuthor: Int64;
|
---|
| 67 | begin
|
---|
| 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;
|
---|
| 94 | end;
|
---|
| 95 |
|
---|
| 96 | procedure TfrmNotesSearchText.cmdCancelClick(Sender: TObject);
|
---|
| 97 | begin
|
---|
| 98 | FChanged:=False;
|
---|
| 99 | Close;
|
---|
| 100 | end;
|
---|
| 101 |
|
---|
| 102 | procedure TfrmNotesSearchText.cmdOKClick(Sender: TObject);
|
---|
| 103 | begin
|
---|
| 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;
|
---|
| 113 | end;
|
---|
| 114 |
|
---|
| 115 | procedure TfrmNotesSearchText.FormShow(Sender: TObject);
|
---|
| 116 | begin
|
---|
| 117 | SetFormPosition(Self);
|
---|
| 118 | end;
|
---|
| 119 |
|
---|
| 120 | procedure TfrmNotesSearchText.FormDestroy(Sender: TObject);
|
---|
| 121 | begin
|
---|
| 122 | SaveUserBounds(Self);
|
---|
| 123 | end;
|
---|
| 124 |
|
---|
| 125 | procedure TfrmNotesSearchText.FormResize(Sender: TObject);
|
---|
| 126 | begin
|
---|
| 127 | inherited;
|
---|
| 128 | lblSearchInfo.Width := edtSearchText.Width;
|
---|
| 129 | end;
|
---|
| 130 |
|
---|
| 131 | end.
|
---|