[456] | 1 | unit fNoteST;
|
---|
| 2 | {
|
---|
| 3 | Text Search CQ: HDS00002856
|
---|
| 4 | This Unit Contains the Dialog Used to Capture the Text that will be
|
---|
| 5 | searched for in the current notes view.
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | interface
|
---|
| 9 |
|
---|
| 10 | uses
|
---|
| 11 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
[830] | 12 | ExtCtrls, ORCtrls, StdCtrls, ORFn, uTIU, fAutoSz, VA508AccessibilityManager;
|
---|
[456] | 13 |
|
---|
| 14 | type
|
---|
| 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 |
|
---|
[1679] | 36 | procedure SelectSearchText(FontSize: Integer; var SearchText: String; var SearchContext: TSearchContext; FormCaption: String = 'List Signed Notes by Author');
|
---|
[456] | 37 |
|
---|
| 38 | implementation
|
---|
| 39 |
|
---|
| 40 | {$R *.DFM}
|
---|
| 41 |
|
---|
| 42 | uses rTIU, rCore, uCore, rMisc;
|
---|
| 43 |
|
---|
| 44 | const
|
---|
| 45 | TX_SEARCH_TEXT = 'Select a search string or press Cancel.';
|
---|
| 46 | TX_SEARCH_CAP = 'Missing search string';
|
---|
| 47 |
|
---|
[1679] | 48 | procedure SelectSearchText(FontSize: Integer; var SearchText: String; var SearchContext: TSearchContext; FormCaption: String = 'List Signed Notes by Author');
|
---|
[456] | 49 | { displays author select form for progress notes and returns a record of the selection }
|
---|
| 50 | var
|
---|
| 51 | frmNotesSearchText: TfrmNotesSearchText;
|
---|
| 52 | W, H: integer;
|
---|
| 53 | // CurrentAuthor: Int64;
|
---|
| 54 | begin
|
---|
| 55 | frmNotesSearchText := TfrmNotesSearchText.Create(Application);
|
---|
| 56 | try
|
---|
[1679] | 57 | frmNotesSearchText.Caption := FormCaption;
|
---|
[456] | 58 | with frmNotesSearchText do
|
---|
| 59 | begin
|
---|
| 60 | edtSearchText.Text:=SearchText;
|
---|
| 61 | Font.Size := FontSize;
|
---|
| 62 | W := ClientWidth;
|
---|
| 63 | H := ClientHeight;
|
---|
| 64 | ResizeToFont(FontSize, W, H);
|
---|
| 65 | // ClientWidth := W; pnlBase.Width := W;
|
---|
| 66 | // ClientHeight := H; pnlBase.Height := W;
|
---|
| 67 | FChanged := False;
|
---|
| 68 | Show;
|
---|
| 69 | edtSearchText.SetFocus;
|
---|
| 70 | Hide;
|
---|
| 71 | ShowModal;
|
---|
| 72 | If edtSearchText.Text<>'' then
|
---|
| 73 | with SearchContext do
|
---|
| 74 | begin
|
---|
| 75 | Changed := FChanged;
|
---|
| 76 | SearchString := FSearchString;
|
---|
| 77 | end; {with SearchContext}
|
---|
| 78 | end; {with frmNotesSearchText}
|
---|
| 79 | finally
|
---|
| 80 | frmNotesSearchText.Release;
|
---|
| 81 | end;
|
---|
| 82 | end;
|
---|
| 83 |
|
---|
| 84 | procedure TfrmNotesSearchText.cmdCancelClick(Sender: TObject);
|
---|
| 85 | begin
|
---|
| 86 | FChanged:=False;
|
---|
| 87 | Close;
|
---|
| 88 | end;
|
---|
| 89 |
|
---|
| 90 | procedure TfrmNotesSearchText.cmdOKClick(Sender: TObject);
|
---|
| 91 | begin
|
---|
| 92 | if edtSearchText.Text = '' then
|
---|
| 93 | begin
|
---|
| 94 | InfoBox(TX_SEARCH_TEXT, TX_SEARCH_CAP, MB_OK or MB_ICONWARNING);
|
---|
| 95 | Exit;
|
---|
| 96 | end;
|
---|
| 97 | FChanged := True;
|
---|
| 98 | FSearchString := edtSearchText.Text;
|
---|
| 99 | Close;
|
---|
| 100 | end;
|
---|
| 101 |
|
---|
| 102 | procedure TfrmNotesSearchText.FormShow(Sender: TObject);
|
---|
| 103 | begin
|
---|
| 104 | SetFormPosition(Self);
|
---|
| 105 | end;
|
---|
| 106 |
|
---|
| 107 | procedure TfrmNotesSearchText.FormDestroy(Sender: TObject);
|
---|
| 108 | begin
|
---|
| 109 | SaveUserBounds(Self);
|
---|
| 110 | end;
|
---|
| 111 |
|
---|
| 112 | procedure TfrmNotesSearchText.FormResize(Sender: TObject);
|
---|
| 113 | begin
|
---|
| 114 | inherited;
|
---|
| 115 | lblSearchInfo.Width := edtSearchText.Width;
|
---|
| 116 | end;
|
---|
| 117 |
|
---|
| 118 | end.
|
---|