unit bug;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 =
class(TForm)
RichEdit1: TRichEdit;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
richedit1.SetFocus;
richedit1.text:='
Hello world';
richedit1.SelStart:=length(richedit1.text);
label2.Caption:=inttostr(richedit1.SelStart);
label3.Caption:=inttostr(length(richedit1.Text));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
richedit1.Text:=richedit1.Text+#13+#10+'
Hello world';
richedit1.SelStart:=length(richedit1.text);
label2.Caption:=inttostr(richedit1.SelStart);
label3.Caption:=inttostr(length(richedit1.Text));
end;
end.