source: cprs/trunk/CPRS-Chart/Orders/fODRadConShRes.pas@ 836

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

Upgrade to version 27

File size: 3.1 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 BringToFront;
63 ShowModal;
64 end
65 {else if Items.Count = 1 then
66 FSource := Items[0]}
67 else
68 FSource := '-1';
69 end
70 else if SrcType = 'R' then
71 begin
72 cboSource.Enabled := False;
73 txtResearch.BringToFront;
74 txtResearch.Text := Source;
75 ShowModal;
76 FSource := txtResearch.Text;
77 end;
78 Source:= FSource ;
79 end; {frmODRadConShRes}
80 finally
81 frmODRadConShRes.Release;
82 end;
83end;
84
85procedure TfrmODRadConShRes.cmdCancelClick(Sender: TObject);
86begin
87 FChanged := False ;
88 FSource := '';
89 Close;
90end;
91
92procedure TfrmODRadConShRes.cmdOKClick(Sender: TObject);
93begin
94 if cboSource.Enabled then with cboSource do
95 begin
96 if ItemIEN = 0 then
97 begin
98 InfoBox(TX_CS_TEXT, TX_CS_CAP, MB_OK or MB_ICONWARNING);
99 FChanged := False ;
100 FSource := '';
101 Exit;
102 end;
103 FChanged := True;
104 FSource := Items[ItemIndex];
105 end
106 else
107 begin
108 if (Length(txtResearch.Text)<3) or (Length(txtResearch.Text)> 40) then
109 begin
110 InfoBox(TX_R_TEXT, TX_R_CAP, MB_OK or MB_ICONWARNING);
111 FChanged := False ;
112 FSource := '';
113 Exit;
114 end ;
115 FChanged := True;
116 FSource := txtResearch.Text;
117 end;
118 Close;
119end;
120
121end.
Note: See TracBrowser for help on using the repository browser.