unit ufmMain; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, TVicLib, HW_Types, StdCtrls, ExtCtrls, uEdit, SSLRecordEvents, SSLRecord_TLB; type TDisplayType = (displayClock12, displayClock24, displayCounter, displayReuters, displayBar); TfmMain = class(TForm) Timer: TTimer; GroupBox1: TGroupBox; rbCounter: TRadioButton; rbClock12: TRadioButton; Label1: TLabel; sbCounter: TScrollBar; Label2: TLabel; rbClock24: TRadioButton; GroupBox2: TGroupBox; ckTest1: TCheckBox; ckTest2: TCheckBox; ckTest3: TCheckBox; Label3: TLabel; Label4: TLabel; ckShutdown1: TCheckBox; ckShutdown2: TCheckBox; ckShutdown3: TCheckBox; ckTestAll: TCheckBox; ckShutdownAll: TCheckBox; Label5: TLabel; sbBrightness: TScrollBar; Label6: TLabel; Label7: TLabel; rbReuters: TRadioButton; ebRic: TuEdit; Label8: TLabel; recordBag: T_IRecordBagEvents; ebDisplay: TEdit; rbBar: TRadioButton; Label9: TLabel; sbBar: TScrollBar; Label10: TLabel; rbScroll: TRadioButton; TimerScroll: TTimer; btTest: TButton; procedure FormCreate(Sender: TObject); procedure TimerTimer(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure rbClick(Sender: TObject); procedure sbCounterChange(Sender: TObject); procedure modeSet(Sender: TObject); procedure ckTestAllClick(Sender: TObject); procedure ckShutdownAllClick(Sender: TObject); procedure sbBrightnessChange(Sender: TObject); procedure rtUpdate(const bag: TObject; index: Integer); procedure ebRicChangeValue(Sender: TObject; value: Variant); procedure rbScrollClick(Sender: TObject); procedure TimerScrollTimer(Sender: TObject); procedure btTestClick(Sender: TObject); private n : integer; doingChecks : boolean; reutersValue : double; ric : string; display : TDisplayType; scroll : integer; basePort : integer; lastData : boolean; lastClk : boolean; testing : boolean; procedure initiateDisplay; function testFlag(stts : integer; condition : integer) : boolean; procedure writeData(data : boolean); procedure writeRegister(reg, data : integer); procedure writeDisplay(reg, d1, d2, d3 : integer); function digit(n, col : integer) : integer; function sdigit(n, col : integer) : integer; function ldigit(n, col : integer) : integer; procedure clock12; procedure clock24; procedure counter; procedure reuters; procedure bar; procedure setTimer; function digitBit(bit : integer) : integer; function column(col : integer) : integer; public end; var fmMain: TfmMain; implementation {$R *.DFM} var HW32 : THandle; ActiveHW : boolean; const NMD0 = 2; NMCS = 14; NMCK = 1; digitsl : array[0..9,0..7,0..7] of Byte = ( ((0,0,0,0,0,0,0,0), // 0 (0,0,1,1,1,1,0,0), (0,1,0,0,0,1,1,0), (0,1,0,0,1,0,1,0), (0,1,0,1,0,0,1,0), (0,1,1,0,0,0,1,0), (0,0,1,1,1,1,0,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 1 (0,0,0,1,1,0,0,0), (0,0,1,0,1,0,0,0), (0,0,0,0,1,0,0,0), (0,0,0,0,1,0,0,0), (0,0,0,0,1,0,0,0), (0,0,1,1,1,1,1,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 2 (0,0,1,1,1,1,0,0), (0,1,0,0,0,0,1,0), (0,0,0,0,0,0,1,0), (0,0,1,1,1,1,0,0), (0,1,0,0,0,0,0,0), (0,1,1,1,1,1,1,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 3 (0,0,1,1,1,1,0,0), (0,1,0,0,0,0,1,0), (0,0,0,0,1,1,0,0), (0,0,0,0,0,0,1,0), (0,1,0,0,0,0,1,0), (0,0,1,1,1,1,0,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 4 (0,0,0,0,1,0,0,0), (0,0,0,1,1,0,0,0), (0,0,1,0,1,0,0,0), (0,1,0,0,1,0,0,0), (0,1,1,1,1,1,1,0), (0,0,0,0,1,0,0,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 5 (0,1,1,1,1,1,1,0), (0,1,0,0,0,0,0,0), (0,1,1,1,1,1,0,0), (0,0,0,0,0,0,1,0), (0,1,0,0,0,0,1,0), (0,0,1,1,1,1,0,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 6 (0,0,1,1,1,1,0,0), (0,1,0,0,0,0,0,0), (0,1,1,1,1,1,0,0), (0,1,0,0,0,0,1,0), (0,1,0,0,0,0,1,0), (0,0,1,1,1,1,0,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 7 (0,1,1,1,1,1,1,0), (0,0,0,0,0,0,1,0), (0,0,0,0,0,1,0,0), (0,0,0,0,1,0,0,0), (0,0,0,1,0,0,0,0), (0,0,0,1,0,0,0,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 8 (0,0,1,1,1,1,0,0), (0,1,0,0,0,0,1,0), (0,0,1,1,1,1,0,0), (0,1,0,0,0,0,1,0), (0,1,0,0,0,0,1,0), (0,0,1,1,1,1,0,0), (0,0,0,0,0,0,0,0)), ((0,0,0,0,0,0,0,0), // 9 (0,0,1,1,1,1,0,0), (0,1,0,0,0,0,1,0), (0,1,0,0,0,0,1,0), (0,0,1,1,1,1,1,0), (0,0,0,0,0,0,1,0), (0,0,1,1,1,1,0,0), (0,0,0,0,0,0,0,0))); digits : array[0..9,0..7,0..3] of Byte = ( ((0,1,1,0), // 0 (1,0,0,1), (1,0,0,1), (1,0,0,1), (1,0,0,1), (1,0,0,1), (1,0,0,1), (0,1,1,0)), ((0,0,1,0), // 1 (0,0,1,0), (0,0,1,0), (0,0,1,0), (0,0,1,0), (0,0,1,0), (0,0,1,0), (0,0,1,0)), ((0,1,1,0), // 2 (1,0,0,1), (0,0,0,1), (0,0,0,1), (0,0,1,0), (0,1,0,0), (1,0,0,0), (1,1,1,1)), ((0,1,1,0), // 3 (1,0,0,1), (0,0,0,1), (0,0,1,0), (0,0,0,1), (0,0,0,1), (1,0,0,1), (0,1,1,0)), ((0,0,0,1), // 4 (0,0,1,0), (0,1,0,0), (1,0,0,0), (1,0,0,0), (1,0,1,0), (1,1,1,1), (0,0,1,0)), ((1,1,1,1), // 5 (1,0,0,0), (1,0,0,0), (1,1,1,0), (0,0,0,1), (0,0,0,1), (1,0,0,1), (0,1,1,0)), ((0,1,1,0), // 6 (1,0,0,1), (1,0,0,0), (1,1,1,0), (1,0,0,1), (1,0,0,1), (1,0,0,1), (0,1,1,0)), ((1,1,1,1), // 7 (0,0,0,1), (0,0,0,1), (0,0,0,1), (0,0,1,0), (0,0,1,0), (0,0,1,0), (0,0,1,0)), ((0,1,1,0), // 8 (1,0,0,1), (1,0,0,1), (0,1,1,0), (1,0,0,1), (1,0,0,1), (1,0,0,1), (0,1,1,0)), ((0,1,1,0), // 9 (1,0,0,1), (1,0,0,1), (0,1,1,1), (0,0,0,1), (0,0,0,1), (1,0,0,1), (0,1,1,0))); digitss : array[0..9,0..7,0..2] of Byte = ( ((0,0,0), // 0 (1,1,1), (1,0,1), (1,0,1), (1,0,1), (1,0,1), (1,0,1), (1,1,1)), ((0,0,0), // 1 (0,1,0), (0,1,0), (0,1,0), (0,1,0), (0,1,0), (0,1,0), (0,1,0)), ((0,0,0), // 2 (1,1,1), (0,0,1), (0,0,1), (1,1,1), (1,0,0), (1,0,0), (1,1,1)), ((0,0,0), // 3 (1,1,1), (0,0,1), (0,0,1), (1,1,1), (0,0,1), (0,0,1), (1,1,1)), ((0,0,0), // 4 (1,0,1), (1,0,1), (1,0,1), (1,1,1), (0,0,1), (0,0,1), (0,0,1)), ((0,0,0), // 5 (1,1,1), (1,0,0), (1,0,0), (1,1,1), (0,0,1), (0,0,1), (1,1,1)), ((0,0,0), // 6 (1,1,1), (1,0,0), (1,0,0), (1,1,1), (1,0,1), (1,0,1), (1,1,1)), ((0,0,0), // 7 (1,1,1), (0,0,1), (0,0,1), (0,0,1), (0,0,1), (0,0,1), (0,0,1)), ((0,0,0), // 8 (1,1,1), (1,0,1), (1,0,1), (1,1,1), (1,0,1), (1,0,1), (1,1,1)), ((0,0,0), // 9 (1,1,1), (1,0,1), (1,0,1), (1,1,1), (0,0,1), (0,0,1), (1,1,1))); procedure TfmMain.initiateDisplay; begin writeDisplay(9, 0, 0, 0); // Decode: None // Brightness writeDisplay(10, sbBrightness.position, sbBrightness.position, sbBrightness.position); writeDisplay(11, 7, 7, 7); // Scan: All modeSet(Self); end; procedure TfmMain.FormCreate(Sender: TObject); var buff : array[0..24] of Char; i : integer; begin HW32 := 0; HW32 := OpenTVicHW32(HW32, 'TVicHW32', StrPCopy(buff, 'TVicDevice0')); ActiveHW := GetActiveHW(HW32); if not ActiveHW then ShowMessage('Can''t open the driver!'); SetHardAccess(HW32, False); basePort := GetLPTBasePort(HW32); initiateDisplay; for i := 1 to 8 do // Clear displays writeDisplay(i, 0, 0, 0); display := displayClock12; timertimer(Sender); ric := ebRic.text; recordBag.rtConnect('IDN_SELECTFEED'); recordBag.subscribe(self, 0, rtUpdate, nil, ric, 'BID ASK TRDPRC_1', True); end; function TfmMain.testFlag(stts : integer; condition : integer) : boolean; begin Result := ((condition <> 0) and ((stts and condition) = condition)); end; procedure TfmMain.writeData(data : boolean); begin setPortByte(HW32, basePort + 2, 3); setPortByte(HW32, basePort, integer(data) + 128 * integer(lastClk)); lastClk := not lastClk; // if data <> lastData then // begin // setPortByte(HW32, basePort, integer(data)); // lastData := data; // end; setPortByte(HW32, basePort + 2, 2); end; procedure TfmMain.writeRegister(reg, data : integer); begin writeData(False); writeData(False); writeData(False); writeData(False); writeData(testFlag(reg, 8)); writeData(testFlag(reg, 4)); writeData(testFlag(reg, 2)); writeData(testFlag(reg, 1)); writeData(testFlag(data, 128)); writeData(testFlag(data, 64)); writeData(testFlag(data, 32)); writeData(testFlag(data, 16)); writeData(testFlag(data, 8)); writeData(testFlag(data, 4)); writeData(testFlag(data, 2)); writeData(testFlag(data, 1)); end; procedure TfmMain.writeDisplay(reg, d1, d2, d3 : integer); begin setPin(HW32, NMCS, True); writeRegister(reg, d3); writeRegister(reg, d2); writeRegister(reg, d1); setPin(HW32, NMCS, False); setPin(HW32, NMCS, True); end; function TfmMain.digitBit(bit : integer) : integer; begin bit := bit - scroll mod 8; if bit < 0 then bit := bit + 8; Result := 0; case bit of 0 : if (scroll <= 7) or (scroll >= 16) then Result := 64; 1 : if (scroll <= 6) or (scroll >= 15) then Result := 32; 2 : if (scroll <= 5) or (scroll >= 14) then Result := 16; 3 : if (scroll <= 4) or (scroll >= 13) then Result := 8; 4 : if (scroll <= 3) or (scroll >= 12) then Result := 4; 5 : if (scroll <= 2) or (scroll >= 11) then Result := 2; 6 : if (scroll <= 1) or (scroll >= 10) then Result := 1; 7 : if (scroll = 0) or (scroll >= 9) then Result := 128; end; end; function TfmMain.column(col : integer) : integer; begin Result := integer(testFlag(col, 1)) * digitBit(0) + integer(testFlag(col, 2)) * digitBit(1) + integer(testFlag(col, 4)) * digitBit(2) + integer(testFlag(col, 8)) * digitBit(3) + integer(testFlag(col, 16)) * digitBit(4) + integer(testFlag(col, 32)) * digitBit(5) + integer(testFlag(col, 64)) * digitBit(6) + integer(testFlag(col, 128)) * digitBit(7); end; function TfmMain.digit(n, col : integer) : integer; begin Result := digits[n, 6, col] * digitBit(6) + digits[n, 5, col] * digitBit(5) + digits[n, 4, col] * digitBit(4) + digits[n, 3, col] * digitBit(3) + digits[n, 2, col] * digitBit(2) + digits[n, 1, col] * digitBit(1) + digits[n, 0, col] * digitBit(0) + digits[n, 7, col] * digitBit(7); end; function TfmMain.sdigit(n, col : integer) : integer; begin if n < 0 then Result := 0 else Result := digitss[n, 6, col] * digitBit(6) + digitss[n, 5, col] * digitBit(5) + digitss[n, 4, col] * digitBit(4) + digitss[n, 3, col] * digitBit(3) + digitss[n, 2, col] * digitBit(2) + digitss[n, 1, col] * digitBit(1) + digitss[n, 0, col] * digitBit(0) + digitss[n, 7, col] * digitBit(7); end; function TfmMain.ldigit(n, col : integer) : integer; begin Result := digitsl[n, 6, col] * digitBit(6) + digitsl[n, 5, col] * digitBit(5) + digitsl[n, 4, col] * digitBit(4) + digitsl[n, 3, col] * digitBit(3) + digitsl[n, 2, col] * digitBit(2) + digitsl[n, 1, col] * digitBit(1) + digitsl[n, 0, col] * digitBit(0) + digitsl[n, 7, col] * digitBit(7); end; procedure TfmMain.clock12; var s : string; hours10, hours, mins10, mins, secs10, secs, thou : integer; begin initiateDisplay; s := formatDateTime('hhmmsszzz', time); hours := strToInt(copy(s, 1, 2)); mins10 := strToInt(s[3]); mins := strToInt(s[4]); secs10 := strToInt(s[5]); secs := strToInt(s[6]); thou := strToInt(copy(s, 7, 3)); if hours > 12 then hours := hours - 12; if hours = 0 then hours := 12; ebDisplay.text := intToStr(hours) + ':' + intToStr(mins10) + intToStr(mins) + ':' + intToStr(secs10) + intToStr(secs); hours10 := hours div 10; hours := hours mod 10; writeDisplay(1, digit(1, hours10 + 1), digit(mins10, 1), 0); writeDisplay(2, 0, digit(mins10, 2), sdigit(secs10, 0)); writeDisplay(3, digit(hours, 0), digit(mins10, 3), sdigit(secs10, 1)); writeDisplay(4, digit(hours, 1), 0, sdigit(secs10, 2)); writeDisplay(5, digit(hours, 2), digit(mins, 0), 0); writeDisplay(6, digit(hours, 3), digit(mins, 1), sdigit(secs, 0)); writeDisplay(7, column(128 * integer(thou < 500)), digit(mins, 2), sdigit(secs, 1)); writeDisplay(8, digit(mins10, 0), digit(mins, 3), sdigit(secs, 2)); end; procedure TfmMain.clock24; var s : string; hours10, hours, mins10, mins, secs10, secs, thou : integer; begin initiateDisplay; s := formatDateTime('hhmmsszzz', time); hours10 := strToInt(s[1]); hours := strToInt(s[2]); mins10 := strToInt(s[3]); mins := strToInt(s[4]); secs10 := strToInt(s[5]); secs := strToInt(s[6]); thou := strToInt(copy(s, 7, 3)); ebDisplay.text := intToStr(hours10) + intToStr(hours) + ':' + intToStr(mins10) + intToStr(mins) + ':' + intToStr(secs10) + intToStr(secs); writeDisplay(1, sdigit(hours10, 0), 0, 0); writeDisplay(2, sdigit(hours10, 1), sdigit(mins10, 0), sdigit(secs10, 0)); writeDisplay(3, sdigit(hours10, 2), sdigit(mins10, 1), sdigit(secs10, 1)); writeDisplay(4, 0, sdigit(mins10, 2), sdigit(secs10, 2)); writeDisplay(5, sdigit(hours, 0), 0, 0); writeDisplay(6, sdigit(hours, 1), sdigit(mins, 0), sdigit(secs, 0)); writeDisplay(7, sdigit(hours, 2), sdigit(mins, 1), sdigit(secs, 1)); writeDisplay(8, column(128 * integer(thou < 500)), sdigit(mins, 2), sdigit(secs, 2)); end; procedure TfmMain.reuters; var s : string; dp, len : integer; d1, d2, d3, d4, d5, d6 : integer; begin try initiateDisplay; s := floatToStr(reutersValue); len := length(s); dp := pos('.', s); if dp <> 0 then len := len - 1; ebDisplay.text := s; s := s + '0000000'; d1 := strToInt(s[1]); if dp > 2 then d2 := strToInt(s[2]) else d2 := strToInt(s[3]); if dp > 3 then d3 := strToInt(s[3]) else d3 := strToInt(s[4]); if dp > 4 then d4 := strToInt(s[4]) else d4 := strToInt(s[5]); if dp > 5 then d5 := strToInt(s[5]) else d5 := strToInt(s[6]); if dp > 6 then d6 := strToInt(s[6]) else d6 := strToInt(s[7]); if len < 6 then d6 := -1; if len < 5 then d5 := -1; if len < 4 then d4 := -1; if len < 3 then d3 := -1; if len < 2 then d2 := -1; writeDisplay(1, column(128 * integer(dp = 1)), column(128 * integer(dp = 3)), column(128 * integer(dp = 5))); writeDisplay(2, sdigit(d1, 0), sdigit(d3, 0), sdigit(d5, 0)); writeDisplay(3, sdigit(d1, 1), sdigit(d3, 1), sdigit(d5, 1)); writeDisplay(4, sdigit(d1, 2), sdigit(d3, 2), sdigit(d5, 2)); writeDisplay(5, column(128 * integer(dp = 2)), column(128 * integer(dp = 4)), column(128 * integer(dp = 6))); writeDisplay(6, sdigit(d2, 0), sdigit(d4, 0), sdigit(d6, 0)); writeDisplay(7, sdigit(d2, 1), sdigit(d4, 1), sdigit(d6, 1)); writeDisplay(8, sdigit(d2, 2), sdigit(d4, 2), sdigit(d6, 2)); except end; end; procedure TfmMain.counter; var i, d1, d2, d3 : integer; begin if not testing then initiateDisplay; n := n + 1; if n = 1000 then n := 0; d1 := n div 100; d2 := (n mod 100) div 10; d3 := (n mod 100) mod 10; for i := 1 to 8 do writeDisplay(i, ldigit(d1, i - 1), ldigit(d2, i - 1), ldigit(d3, i - 1)); if timer.enabled then ebDisplay.text := intToStr(n); end; procedure TfmMain.bar; begin initiateDisplay; ebDisplay.text := intToStr(sbBar.position) + ' / 24'; writeDisplay(1, column(255) * integer(sbBar.position > 0), column(255) * integer(sbBar.position > 8), column(255) * integer(sbBar.position > 16)); writeDisplay(2, column(255) * integer(sbBar.position > 1), column(255) * integer(sbBar.position > 9), column(255) * integer(sbBar.position > 17)); writeDisplay(3, column(255) * integer(sbBar.position > 2), column(255) * integer(sbBar.position > 10), column(255) * integer(sbBar.position > 18)); writeDisplay(4, column(255) * integer(sbBar.position > 3), column(255) * integer(sbBar.position > 11), column(255) * integer(sbBar.position > 19)); writeDisplay(5, column(255) * integer(sbBar.position > 4), column(255) * integer(sbBar.position > 12), column(255) * integer(sbBar.position > 20)); writeDisplay(6, column(255) * integer(sbBar.position > 5), column(255) * integer(sbBar.position > 13), column(255) * integer(sbBar.position > 21)); writeDisplay(7, column(255) * integer(sbBar.position > 6), column(255) * integer(sbBar.position > 14), column(255) * integer(sbBar.position > 22)); writeDisplay(8, column(255) * integer(sbBar.position > 7), column(255) * integer(sbBar.position > 15), column(255) * integer(sbBar.position > 23)); end; procedure TfmMain.TimerTimer(Sender: TObject); begin if display in [displayClock12, displayClock24] then timer.interval := 500; case display of displayClock12 : clock12; displayClock24 : clock24; displayCounter : counter; displayReuters : reuters; displayBar : bar; end; end; procedure TfmMain.FormClose(Sender: TObject; var Action: TCloseAction); begin writeDisplay(12, 0, 0, 0); // Mode: Shutdown HW32 := CloseTVicHW32(HW32); ActiveHW := FALSE; end; procedure TfmMain.setTimer; begin if display = displayCounter then timer.interval := 10 * (sbCounter.max - sbCounter.position) + sbCounter.min else if display in [displayClock12, displayClock24] then timer.interval := round((1.0 - frac(time * 3600 * 24)) * 1000); timer.enabled := display in [displayCounter, displayClock12, displayClock24]; end; procedure TfmMain.rbClick(Sender: TObject); begin display := TDisplayType(TRadioButton(Sender).tag); scroll := 0; timerScroll.enabled := False; setTimer; timerTimer(Sender); end; procedure TfmMain.sbCounterChange(Sender: TObject); begin timer.interval := 10 * (sbCounter.max - sbCounter.position) + sbCounter.min; end; procedure TfmMain.modeSet(Sender: TObject); begin if not doingChecks then begin doingChecks := True; writeDisplay(12, integer(not ckShutdown1.checked), integer(not ckShutdown2.checked), integer(not ckShutdown3.checked)); writeDisplay(15, integer(ckTest1.checked), integer(ckTest2.checked), integer(ckTest3.checked)); if (ckTest1.checked = ckTest2.checked) and (ckTest1.checked = ckTest3.checked) then ckTestAll.checked := ckTest1.checked else ckTestAll.state := cbGrayed; if (ckShutdown1.checked = ckShutdown2.checked) and (ckShutdown1.checked = ckShutdown3.checked) then ckShutdownAll.checked := ckShutdown1.checked else ckShutdownAll.state := cbGrayed; doingChecks := False; end; end; procedure TfmMain.ckTestAllClick(Sender: TObject); begin if not doingChecks then begin doingChecks := True; ckTest1.checked := ckTestAll.checked; ckTest2.checked := ckTestAll.checked; ckTest3.checked := ckTestAll.checked; doingChecks := False; modeSet(Sender); end; end; procedure TfmMain.ckShutdownAllClick(Sender: TObject); begin if not doingChecks then begin doingChecks := True; ckShutdown1.checked := ckShutdownAll.checked; ckShutdown2.checked := ckShutdownAll.checked; ckShutdown3.checked := ckShutdownAll.checked; doingChecks := False; modeSet(Sender); end; end; procedure TfmMain.sbBrightnessChange(Sender: TObject); begin writeDisplay(10, sbBrightness.position, sbBrightness.position, sbBrightness.position); end; procedure TfmMain.rtUpdate(const bag: TObject; index: Integer); begin try if T_IRecordBagEvents(bag).value(index, 'TRDPRC_1') <> '' then reutersValue := strToFloat(T_IRecordBagEvents(bag).value(index, 'TRDPRC_1')) else reutersValue := 0.5 * (strToFloat(T_IRecordBagEvents(bag).value(index, 'BID')) + strToFloat(T_IRecordBagEvents(bag).value(index, 'ASK'))); except reutersValue := 0.0; end; if rbReuters.checked then reuters; end; procedure TfmMain.ebRicChangeValue(Sender: TObject; value: Variant); begin recordBag.unsubscribe(self, 0, ric); ric := ebRic.text; recordBag.subscribe(self, 0, rtUpdate, nil, ric, 'BID ASK TRDPRC_1', True); end; procedure TfmMain.rbScrollClick(Sender: TObject); begin timerScroll.interval := 50; timerScroll.enabled := True; end; procedure TfmMain.TimerScrollTimer(Sender: TObject); begin if scroll < 16 then begin timerScroll.interval := 50; scroll := scroll + 1; timerTimer(Sender); if scroll = 8 then begin if display = displayBar then display := displayClock12 else display := TDisplayType(integer(display) + 1); setTimer; end; end else begin timerScroll.interval := 3000; scroll := 0; end; end; procedure TfmMain.btTestClick(Sender: TObject); var i : integer; oldDisplay : TDisplayType; oldTimerEnabled : boolean; startTime : TDateTime; begin testing := True; oldDisplay := display; oldTimerEnabled := timer.enabled; testing := True; display := displayCounter; timer.enabled := False; startTime := time; for i := 0 to 999 do begin n := i; timerTimer(Sender); end; display := oldDisplay; timer.enabled := oldTimerEnabled; showMessage('Write test: displayed ' + intToStr(round(3000.0 / ((time - startTime) * 3600 * 24))) + ' modules / second.'); testing := False; end; end.