[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 |
|
---|
| 36 | procedure SelectSearchText(FontSize: Integer; var SearchText: String; var SearchContext: TSearchContext);
|
---|
| 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 |
|
---|
| 48 | procedure SelectSearchText(FontSize: Integer; var SearchText: String; var SearchContext: TSearchContext);
|
---|
| 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
|
---|
| 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;
|
---|
| 81 | end;
|
---|
| 82 |
|
---|
| 83 | procedure TfrmNotesSearchText.cmdCancelClick(Sender: TObject);
|
---|
| 84 | begin
|
---|
| 85 | FChanged:=False;
|
---|
| 86 | Close;
|
---|
| 87 | end;
|
---|
| 88 |
|
---|
| 89 | procedure TfrmNotesSearchText.cmdOKClick(Sender: TObject);
|
---|
| 90 | begin
|
---|
| 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;
|
---|
| 99 | end;
|
---|
| 100 |
|
---|
| 101 | procedure TfrmNotesSearchText.FormShow(Sender: TObject);
|
---|
| 102 | begin
|
---|
| 103 | SetFormPosition(Self);
|
---|
| 104 | end;
|
---|
| 105 |
|
---|
| 106 | procedure TfrmNotesSearchText.FormDestroy(Sender: TObject);
|
---|
| 107 | begin
|
---|
| 108 | SaveUserBounds(Self);
|
---|
| 109 | end;
|
---|
| 110 |
|
---|
| 111 | procedure TfrmNotesSearchText.FormResize(Sender: TObject);
|
---|
| 112 | begin
|
---|
| 113 | inherited;
|
---|
| 114 | lblSearchInfo.Width := edtSearchText.Width;
|
---|
| 115 | end;
|
---|
| 116 |
|
---|
| 117 | end.
|
---|