source: cprs/branches/HealthSevak-CPRS/CPRS-Chart/Orders/fODRadConShRes.pas@ 1763

Last change on this file since 1763 was 1693, checked in by healthsevak, 10 years ago

Committing the files for first time to this new branch

File size: 3.3 KB
Line 
1unit fODRadConShRes;
2
3interface
4
5uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
6 Buttons, ORCtrls, ORfn, ExtCtrls, fBase508Form, VA508AccessibilityManager;
7
8type
9 TfrmODRadConShRes = class(TfrmBase508Form)
10 cmdOK: TButton;
11 cmdCancel: TButton;
12 cboSource: TORComboBox;
13 SrcLabel: TLabel;
14 pnlBase: TORAutoPanel;
15 txtResearch: TCaptionEdit;
16 procedure cmdOKClick(Sender: TObject);
17 procedure cmdCancelClick(Sender: TObject);
18 private
19 FSource: string ;
20 FChanged: Boolean;
21 end;
22
23procedure SelectSource(FontSize: Integer; SrcType: char; var Source: string) ;
24
25implementation
26
27{$R *.DFM}
28
29uses rODRad, rCore, uCore;
30
31const
32 TX_CS_TEXT = 'Select Source, or press Cancel.';
33 TX_CS_CAP = 'No Source';
34 TX_R_TEXT = 'Enter Source (3-40 characters), or press Cancel.';
35 TX_R_CAP = 'No Source';
36
37procedure SelectSource(FontSize: Integer; SrcType: char; var Source: string) ;
38{ displays Source entry/selection form and returns a record of the selection }
39var
40 frmODRadConShRes: TfrmODRadConShRes;
41 W, H: Integer;
42begin
43 frmODRadConShRes := TfrmODRadConShRes.Create(Application);
44 try
45 with frmODRadConShRes do
46 begin
47 Font.Size := FontSize;
48 W := ClientWidth;
49 H := ClientHeight;
50 ResizeToFont(FontSize, W, H);
51 ClientWidth := W; pnlBase.Width := W;
52 ClientHeight := H; pnlBase.Height := H;
53 FChanged := False;
54 if SrcType in ['C','S'] then with cboSource do
55 begin
56 FastAssign(SubsetOfRadSources(SrcType), cboSource.Items);
57 if Items.Count > 0 then
58 begin
59 txtResearch.Enabled := False;
60 Enabled := True;
61 SelectByID(Piece(Source,U,1));
62 cboSource.Visible := True;
63 txtResearch.Visible := False;
64 //BringToFront;
65 ShowModal;
66 end
67 {else if Items.Count = 1 then
68 FSource := Items[0]}
69 else
70 FSource := '-1';
71 end
72 else if SrcType = 'R' then
73 begin
74 cboSource.Enabled := False;
75 cboSource.Visible := False;
76 srcLabel.Caption := 'Enter Source:';
77 txtResearch.Visible := True;
78 //txtResearch.BringToFront;
79 txtResearch.Text := Source;
80 ShowModal;
81 FSource := txtResearch.Text;
82 end;
83 Source:= FSource ;
84 end; {frmODRadConShRes}
85 finally
86 frmODRadConShRes.Release;
87 end;
88end;
89
90procedure TfrmODRadConShRes.cmdCancelClick(Sender: TObject);
91begin
92 FChanged := False ;
93 FSource := '';
94 Close;
95end;
96
97procedure TfrmODRadConShRes.cmdOKClick(Sender: TObject);
98begin
99 if cboSource.Enabled then with cboSource do
100 begin
101 if ItemIEN = 0 then
102 begin
103 InfoBox(TX_CS_TEXT, TX_CS_CAP, MB_OK or MB_ICONWARNING);
104 FChanged := False ;
105 FSource := '';
106 Exit;
107 end;
108 FChanged := True;
109 FSource := Items[ItemIndex];
110 end
111 else
112 begin
113 if (Length(txtResearch.Text)<3) or (Length(txtResearch.Text)> 40) then
114 begin
115 InfoBox(TX_R_TEXT, TX_R_CAP, MB_OK or MB_ICONWARNING);
116 FChanged := False ;
117 FSource := '';
118 Exit;
119 end ;
120 FChanged := True;
121 FSource := txtResearch.Text;
122 end;
123 Close;
124end;
125
126end.
Note: See TracBrowser for help on using the repository browser.