| 1 |
unit ConsoleF; |
| 2 |
|
| 3 |
{$mode objfpc}{$H+} |
| 4 |
|
| 5 |
interface |
| 6 |
|
| 7 |
uses |
| 8 |
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, |
| 9 |
CastleLog; |
| 10 |
|
| 11 |
type |
| 12 |
|
| 13 |
{ TConsole } |
| 14 |
|
| 15 |
TConsole = class(TForm) |
| 16 |
Button1: TButton; |
| 17 |
Memo1: TMemo; |
| 18 |
procedure Button1Click(Sender: TObject); |
| 19 |
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); |
| 20 |
procedure FormCreate(Sender: TObject); |
| 21 |
procedure FormDestroy(Sender: TObject); |
| 22 |
private |
| 23 |
public |
| 24 |
WasWarnings: boolean; |
| 25 |
procedure WarningToConsole(const Category, S: string); |
| 26 |
end; |
| 27 |
|
| 28 |
var |
| 29 |
Console: TConsole; |
| 30 |
|
| 31 |
implementation |
| 32 |
|
| 33 |
uses MainF, |
| 34 |
CastleApplicationProperties; |
| 35 |
|
| 36 |
{$R *.lfm} |
| 37 |
|
| 38 |
{ TConsole } |
| 39 |
|
| 40 |
procedure TConsole.WarningToConsole(const Category, S: string); |
| 41 |
begin |
| 42 |
Memo1.Lines.Append(Category + ': ' + S); |
| 43 |
WasWarnings := true; |
| 44 |
end; |
| 45 |
|
| 46 |
procedure TConsole.Button1Click(Sender: TObject); |
| 47 |
begin |
| 48 |
Close; |
| 49 |
end; |
| 50 |
|
| 51 |
procedure TConsole.FormClose(Sender: TObject; var CloseAction: TCloseAction); |
| 52 |
begin |
| 53 |
Main.MenuShowConsole.Checked := false; |
| 54 |
end; |
| 55 |
|
| 56 |
procedure TConsole.FormCreate(Sender: TObject); |
| 57 |
begin |
| 58 |
ApplicationProperties.OnWarning.Add(@WarningToConsole); |
| 59 |
end; |
| 60 |
|
| 61 |
procedure TConsole.FormDestroy(Sender: TObject); |
| 62 |
begin |
| 63 |
ApplicationProperties.OnWarning.Remove(@WarningToConsole); |
| 64 |
end; |
| 65 |
|
| 66 |
end. |
| 67 |
|