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

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

Enhanced 'Last Broker Call' dialog

File size: 4.3 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 procedure cmdPrevClick(Sender: TObject);
25 procedure cmdNextClick(Sender: TObject);
26 procedure FormClose(Sender: TObject; var Action: TCloseAction);
27 procedure FormResize(Sender: TObject);
28 procedure FormCreate(Sender: TObject);
29 procedure FormKeyUp(Sender: TObject; var Key: Word;
30 Shift: TShiftState);
31 procedure btnRLTClick(Sender: TObject);
32 procedure btnClearClick(Sender: TObject);
33 private
34 { Private declarations }
35 FRetained: Integer;
36 FCurrent: Integer;
37 public
38 { Public declarations }
39 end;
40
41procedure ShowBroker;
42
43implementation
44
45{$R *.DFM}
46
47procedure ShowBroker;
48var
49 frmBroker: TfrmBroker;
50begin
51 frmBroker := TfrmBroker.Create(Application);
52 try
53 ResizeAnchoredFormToFont(frmBroker);
54 with frmBroker do
55 begin
56 FRetained := RetainedRPCCount - 1;
57 FCurrent := FRetained;
58 LoadRPCData(memData.Lines, FCurrent);
59 memData.SelStart := 0;
60// lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
61 lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(FRetained - FCurrent); //kt added 8/7/2007
62 ShowModal;
63 end;
64 finally
65 frmBroker.Release;
66 end;
67end;
68
69procedure TfrmBroker.cmdPrevClick(Sender: TObject);
70begin
71 FCurrent := HigherOf(FCurrent - 1, 0);
72 LoadRPCData(memData.Lines, FCurrent);
73 memData.SelStart := 0;
74//lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
75 lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(FRetained - FCurrent); //kt added 8/7/2007
76end;
77
78procedure TfrmBroker.cmdNextClick(Sender: TObject);
79begin
80 FCurrent := LowerOf(FCurrent + 1, FRetained);
81 LoadRPCData(memData.Lines, FCurrent);
82 memData.SelStart := 0;
83//lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
84 lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(FRetained - FCurrent); //kt added 8/7/2007
85end;
86
87procedure TfrmBroker.FormClose(Sender: TObject; var Action: TCloseAction);
88begin
89 SetRetainedRPCMax(StrToIntDef(txtMaxCalls.Text, 5))
90end;
91
92procedure TfrmBroker.FormResize(Sender: TObject);
93begin
94 Refresh;
95end;
96
97procedure TfrmBroker.FormCreate(Sender: TObject);
98begin
99 udMax.Position := GetRPCMax;
100end;
101
102procedure TfrmBroker.FormKeyUp(Sender: TObject; var Key: Word;
103 Shift: TShiftState);
104begin
105 if Key = VK_ESCAPE then
106 begin
107 Key := 0;
108 Close;
109 end;
110end;
111
112procedure TfrmBroker.btnRLTClick(Sender: TObject);
113var
114 startTime, endTime: tDateTime;
115 clientVer, serverVer, diffDisplay: string;
116 theDiff: integer;
117 disclaimer : string; //kt
118const
119 TX_OPTION = 'OR CPRS GUI CHART';
120//disclaimer = 'NOTE: Strictly relative indicator:'; <-- original line. //kt 8/7/2007
121begin
122 disclaimer := DKLangConstW('fxBroker_NOTEx_Strictly_relative_indicatorx'); //kt added 8/7/2007
123
124 clientVer := clientVersion(Application.ExeName); // Obtain before starting.
125
126 // Check time lapse between a standard RPC call:
127 startTime := now;
128 serverVer := serverVersion(TX_OPTION, clientVer);
129 endTime := now;
130 theDiff := milliSecondsBetween(endTime, startTime);
131 diffDisplay := intToStr(theDiff);
132
133 // Show the results:
134 //infoBox('Lapsed time (milliseconds) = ' + diffDisplay + '.', disclaimer, MB_OK); <-- original line. //kt 8/7/2007
135 infoBox(DKLangConstW('fxBroker_Lapsed_time_xmillisecondsx_x') + diffDisplay + '.', disclaimer, MB_OK); //kt added 8/7/2007
136
137end;
138
139procedure TfrmBroker.btnClearClick(Sender: TObject);
140 //kt added endtire function
141begin
142 ORNet.RPCCallsClear;
143 FCurrent := 0;
144 FRetained := RetainedRPCCount - 1;
145 cmdNextClick(Sender);
146end;
147
148end.
Note: See TracBrowser for help on using the repository browser.