source: cprs/branches/tmg-cprs/CPRS-Chart/fxBroker.pas@ 1582

Last change on this file since 1582 was 738, checked in by Kevin Toppenberg, 15 years ago

Fixed Text Object Parameters

File size: 6.5 KB
Line 
1//kt -- Modified with SourceScanner on 8/7/2007
2unit fxBroker;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 StdCtrls, DateUtils, ORNet, ORFn, rMisc, ComCtrls, Buttons, ExtCtrls,
9 ORCtrls, ORSystem, DKLang;
10
11type
12 TfrmBroker = class(TForm)
13 pnlTop: TORAutoPanel;
14 lblMaxCalls: TLabel;
15 txtMaxCalls: TCaptionEdit;
16 cmdPrev: TBitBtn;
17 cmdNext: TBitBtn;
18 udMax: TUpDown;
19 memData: TRichEdit;
20 lblCallID: TStaticText;
21 btnRLT: TButton;
22 DKLanguageController1: TDKLanguageController;
23 btnClear: TBitBtn;
24 lblStoredCallsNum: TLabel;
25 cboJumpTo: TComboBox;
26 procedure cmdPrevClick(Sender: TObject);
27 procedure cmdNextClick(Sender: TObject);
28 procedure FormClose(Sender: TObject; var Action: TCloseAction);
29 procedure FormResize(Sender: TObject);
30 procedure FormCreate(Sender: TObject);
31 procedure FormKeyUp(Sender: TObject; var Key: Word;
32 Shift: TShiftState);
33 procedure btnRLTClick(Sender: TObject);
34 procedure btnClearClick(Sender: TObject);
35 procedure cboJumpToDropDown(Sender: TObject);
36 procedure cboJumpToChange(Sender: TObject);
37 private
38 { Private declarations }
39 FRetained: Integer;
40 FCurrent: Integer;
41 procedure UpdateDisplay; //kt added
42 public
43 { Public declarations }
44 end;
45
46procedure ShowBroker;
47
48implementation
49
50{$R *.DFM}
51
52procedure ShowBroker;
53var
54 frmBroker: TfrmBroker;
55begin
56 frmBroker := TfrmBroker.Create(Application);
57 try
58 ResizeAnchoredFormToFont(frmBroker);
59 with frmBroker do
60 begin
61 FRetained := RetainedRPCCount - 1;
62 FCurrent := FRetained;
63 UpdateDisplay; //kt
64 { //kt moved to UpdateDisplay
65 LoadRPCData(memData.Lines, FCurrent);
66 memData.SelStart := 0;
67// lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
68 lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(HigherOf(FRetained - FCurrent,0)); //kt added 8/7/2007
69 lblStoredCallsNum.Caption := DKLangConstW('fxBroker_Stored_Calls') + IntToStr(RetainedRPCCount); //kt added 4/15/10
70 }
71 ShowModal;
72 end;
73 finally
74 frmBroker.Release;
75 end;
76end;
77
78procedure TfrmBroker.cmdPrevClick(Sender: TObject);
79begin
80 FCurrent := HigherOf(FCurrent - 1, 0);
81 UpdateDisplay; //kt
82 { //kt moved to UpdateDisplay
83 LoadRPCData(memData.Lines, FCurrent);
84 memData.SelStart := 0;
85//lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
86 lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(HigherOf(FRetained - FCurrent,0)); //kt added 8/7/2007
87 lblStoredCallsNum.Caption := DKLangConstW('fxBroker_Stored_Calls') + IntToStr(RetainedRPCCount); //kt added 4/15/10
88 }
89end;
90
91procedure TfrmBroker.cmdNextClick(Sender: TObject);
92begin
93 FRetained := RetainedRPCCount - 1; //kt added line 4/15/10
94 FCurrent := LowerOf(FCurrent + 1, FRetained);
95 UpdateDisplay; //kt
96 { //kt moved to UpdateDisplay
97 LoadRPCData(memData.Lines, FCurrent);
98 memData.SelStart := 0;
99//lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
100 lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(HigherOf(FRetained - FCurrent,0)); //kt added 8/7/2007
101 lblStoredCallsNum.Caption := DKLangConstW('fxBroker_Stored_Calls') + IntToStr(RetainedRPCCount); //kt added 4/15/10
102 }
103end;
104
105procedure TfrmBroker.UpdateDisplay; //kt added
106begin
107 FRetained := RetainedRPCCount - 1; //kt added line 4/15/10
108 LoadRPCData(memData.Lines, FCurrent);
109 memData.SelStart := 0;
110//lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
111 lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(HigherOf(FRetained - FCurrent,0)); //kt added 8/7/2007
112 lblStoredCallsNum.Caption := DKLangConstW('fxBroker_Stored_Calls') + IntToStr(RetainedRPCCount); //kt added 4/15/10
113end;
114
115procedure TfrmBroker.cboJumpToDropDown(Sender: TObject);
116//kt added entire function
117var i : integer;
118 s : string;
119 Info : TStringList; //Not owned here...
120begin
121 cboJumpTo.Items.Clear;
122 for i := 0 to RetainedRPCCount - 1 do begin
123 Info := AccessRPCData(i);
124 if Info.Count < 2 then continue;
125 s := Info.Strings[1];
126 s := piece(s,'Called at: ',2);
127 s := s + ': ' + Info.Strings[0];
128 cboJumpTo.Items.Insert(0,s);
129 end;
130end;
131
132procedure TfrmBroker.cboJumpToChange(Sender: TObject);
133//kt added function
134begin
135 if cboJumpTo.Items.count > 0 then begin
136 FCurrent := (cboJumpTo.Items.count-1) - cboJumpTo.ItemIndex;
137 UpdateDisplay; //kt
138 end;
139end;
140
141
142procedure TfrmBroker.FormClose(Sender: TObject; var Action: TCloseAction);
143begin
144 SetRetainedRPCMax(StrToIntDef(txtMaxCalls.Text, 5))
145end;
146
147procedure TfrmBroker.FormResize(Sender: TObject);
148begin
149 Refresh;
150end;
151
152procedure TfrmBroker.FormCreate(Sender: TObject);
153begin
154 udMax.Position := GetRPCMax;
155end;
156
157procedure TfrmBroker.FormKeyUp(Sender: TObject; var Key: Word;
158 Shift: TShiftState);
159begin
160 if Key = VK_ESCAPE then
161 begin
162 Key := 0;
163 Close;
164 end;
165end;
166
167procedure TfrmBroker.btnRLTClick(Sender: TObject);
168var
169 startTime, endTime: tDateTime;
170 clientVer, serverVer, diffDisplay: string;
171 theDiff: integer;
172 disclaimer : string; //kt
173const
174 TX_OPTION = 'OR CPRS GUI CHART';
175//disclaimer = 'NOTE: Strictly relative indicator:'; <-- original line. //kt 8/7/2007
176begin
177 disclaimer := DKLangConstW('fxBroker_NOTEx_Strictly_relative_indicatorx'); //kt added 8/7/2007
178
179 clientVer := clientVersion(Application.ExeName); // Obtain before starting.
180
181 // Check time lapse between a standard RPC call:
182 startTime := now;
183 serverVer := serverVersion(TX_OPTION, clientVer);
184 endTime := now;
185 theDiff := milliSecondsBetween(endTime, startTime);
186 diffDisplay := intToStr(theDiff);
187
188 // Show the results:
189 //infoBox('Lapsed time (milliseconds) = ' + diffDisplay + '.', disclaimer, MB_OK); <-- original line. //kt 8/7/2007
190 infoBox(DKLangConstW('fxBroker_Lapsed_time_xmillisecondsx_x') + diffDisplay + '.', disclaimer, MB_OK); //kt added 8/7/2007
191
192end;
193
194procedure TfrmBroker.btnClearClick(Sender: TObject);
195 //kt added entire function
196begin
197 ORNet.RPCCallsClear;
198 memData.Lines.Clear; //kt 4/15/10
199 cboJumpTo.Text := '-- Select a call to jump to --';
200 FCurrent := 0;
201 FRetained := RetainedRPCCount - 1;
202 cmdNextClick(Sender);
203end;
204
205
206end.
Note: See TracBrowser for help on using the repository browser.