unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure Edit1Enter(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit1Click(Sender: TObject);
private
{ Private-Deklarationen }
FTimeStamp :
String;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FTimeStamp:=DateToStr(Now)+'
'+TimeToStr(Now)+'
: ';
Edit1.Text:=FTimeStamp;
end;
procedure TForm1.Edit1Enter(Sender: TObject);
begin
Edit1.SelStart:=Length(FTimeStamp);
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
If (Length(Edit1.Text)<Length(FTimeStamp))
or
(Edit1.SelStart<Length(FTimeStamp))
then
begin
Edit1.Text:=FTimeStamp;
Edit1.SelStart:=Length(FTimeStamp);
end;
end;
procedure TForm1.Edit1Click(Sender: TObject);
begin
If Edit1.SelStart<Length(FTimeStamp)
then
Edit1.SelStart:=Length(FTimeStamp);
end;
end.