unit xocLogger;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,stdctrls;
type
TLogger = class(TComponent)
private
sTIME:String;
FMemo : TMemo;
procedure SetFMemo(val:TMemo);
protected
{ Déclarations protégées }
public
procedure Log(s:string); overload;
procedure Log(s:string; t:Integer); overload;
published
property TheMemo : TMemo read FMemo write SetFMemo;
end;
procedure Register;
implementation
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
procedure Register;
begin
RegisterComponents('Vcl++', [TLogger]);
end;
//------------------------------------------------------------------------------
procedure TLogger.Log(s:string);
begin
FMemo.Lines.Append(s);
end;
//------------------------------------------------------------------------------
procedure TLogger.Log(s:string; t:Integer);
begin
//sLogAA:=StringReplace(s,ret,ret+tab,[rfReplaceAll]);
sTIME:=FormatDateTime('[hh:nn]',Now);
FMemo.Lines.Append(sTIME+' '+s);
end;
(*
//------------------------------------------------------------------------------
procedure TLogger.BOXDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
_CANVA : TCanvas;
str:String;
iko:Integer;
begin
_CANVA:=TListBox(Control).Canvas;
str:=TListBox(Control).Items[Index];
if (str='') then str:=' ';
iko:=StrToIntDef('$'+str[1]+str[2],47);// 47 = empty icon
Delete(str,1,2);
_CANVA.Brush.Color:=TListBox(Control).Color;
_CANVA.Font.Color:=TListBox(Control).Font.Color;
_CANVA.FillRect(Rect);
if (FImageList <> nil) then FImageList.Draw(_CANVA,Rect.Left+2,Rect.Top+1,iko);
_CANVA.TextOut(Rect.Left+20, Rect.Top+1,str);
end;
*)
procedure TLogger.SetFMemo(val: TMemo);
begin
FMemo:=val;
end;
end.
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,stdctrls;
type
TLogger = class(TComponent)
private
sTIME:String;
FMemo : TMemo;
procedure SetFMemo(val:TMemo);
protected
{ Déclarations protégées }
public
procedure Log(s:string); overload;
procedure Log(s:string; t:Integer); overload;
published
property TheMemo : TMemo read FMemo write SetFMemo;
end;
procedure Register;
implementation
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
procedure Register;
begin
RegisterComponents('Vcl++', [TLogger]);
end;
//------------------------------------------------------------------------------
procedure TLogger.Log(s:string);
begin
FMemo.Lines.Append(s);
end;
//------------------------------------------------------------------------------
procedure TLogger.Log(s:string; t:Integer);
begin
//sLogAA:=StringReplace(s,ret,ret+tab,[rfReplaceAll]);
sTIME:=FormatDateTime('[hh:nn]',Now);
FMemo.Lines.Append(sTIME+' '+s);
end;
(*
//------------------------------------------------------------------------------
procedure TLogger.BOXDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
_CANVA : TCanvas;
str:String;
iko:Integer;
begin
_CANVA:=TListBox(Control).Canvas;
str:=TListBox(Control).Items[Index];
if (str='') then str:=' ';
iko:=StrToIntDef('$'+str[1]+str[2],47);// 47 = empty icon
Delete(str,1,2);
_CANVA.Brush.Color:=TListBox(Control).Color;
_CANVA.Font.Color:=TListBox(Control).Font.Color;
_CANVA.FillRect(Rect);
if (FImageList <> nil) then FImageList.Draw(_CANVA,Rect.Left+2,Rect.Top+1,iko);
_CANVA.TextOut(Rect.Left+20, Rect.Top+1,str);
end;
*)
procedure TLogger.SetFMemo(val: TMemo);
begin
FMemo:=val;
end;
end.