source: branches/Independent/Devices/Console.pas

Last change on this file was 68, checked in by chronos, 11 days ago
  • Added: Mouse API support.
File size: 713 bytes
Line 
1unit Console;
2
3interface
4
5uses
6 Classes, SysUtils;
7
8type
9 TWriteEvent = procedure (Text: string) of object;
10 TReadEvent = function: string of object;
11
12 { TConsole }
13
14 TConsole = class
15 private
16 FOnRead: TReadEvent;
17 FOnWrite: TWriteEvent;
18 public
19 procedure Write(Text: string);
20 function Read: string;
21 published
22 property OnWrite: TWriteEvent read FOnWrite write FOnWrite;
23 property OnRead: TReadEvent read FOnRead write FOnRead;
24 end;
25
26
27implementation
28
29{ TConsole }
30
31procedure TConsole.Write(Text: string);
32begin
33 if Assigned(FOnWrite) then FOnWrite(Text);
34end;
35
36function TConsole.Read: string;
37begin
38 if Assigned(FOnRead) then Result := FOnRead
39 else Result := '';
40end;
41
42end.
43
Note: See TracBrowser for help on using the repository browser.