source: branches/ByteArray/Forms/FormConsole.pas

Last change on this file was 10, checked in by chronos, 2 months ago
  • Modified: Improved serial console handling.
File size: 870 bytes
Line 
1unit FormConsole;
2
3interface
4
5uses
6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
7 Device, Serial;
8
9type
10
11 { TFormConsole }
12
13 TFormConsole = class(TFormDevice)
14 Memo1: TMemo;
15 Timer1: TTimer;
16 procedure Timer1Timer(Sender: TObject);
17 private
18 FSerial: TSerial;
19 procedure SetSerial(AValue: TSerial);
20 public
21 property Serial: TSerial read FSerial write SetSerial;
22 end;
23
24
25implementation
26
27{$R *.lfm}
28
29procedure TFormConsole.Timer1Timer(Sender: TObject);
30begin
31 Memo1.Lines.Text := Memo1.Lines.Text + FSerial.ReadOutputBuffer;
32end;
33
34procedure TFormConsole.SetSerial(AValue: TSerial);
35begin
36 if FSerial = AValue then Exit;
37 if Assigned(FSerial) then begin
38 FSerial.OnOutput := nil;
39 end;
40 FSerial := AValue;
41 if Assigned(FSerial) then begin
42 Memo1.Lines.Text := FSerial.ReadOutputBuffer;
43 end;
44end;
45
46end.
47
Note: See TracBrowser for help on using the repository browser.