source: cprs/branches/tmg-cprs/CPRS-Chart/Orders/fODRadConShRes.pas@ 1705

Last change on this file since 1705 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

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