Autor Beitrag
M.Mü
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Sa 14.01.06 02:11 
Hallo,

ich seh wohl den Wald vor Bäumen nicht ...

Gibt es einen Befehl, mit deren Hilfe ich im RichEdit einen String bei der Cursorposition einfügen kann? ... ähnlich wie im NotePad die Datum/Uhrzeit.

Habe es im Moment folgendermaßen realisiert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
var Line: string;
begin
 Line := RichEdit1.Lines[RichEdit1.CaretPos.Y];
 Insert('test',Line,RichEdit1.CaretPos.X+1);
 RichEdit1.Lines[RichEdit1.CaretPos.Y] := Line;
end;


VG M.Mü

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Sa 14.01.2006 um 01:16
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Sa 14.01.06 02:21 
Wie wärs mit:
ausblenden Delphi-Quelltext
1:
2:
RichEdit1.SelLength := 0//Damit man keinen markierten Text überschreibt
RichEdit1.SelText := Line;

_________________
Programmers never die, they just GOSUB without RETURN
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 14.01.06 10:22 
ausblenden Delphi-Quelltext
1:
RichEdit1.SelText:='Mein String';					
M.Mü Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Di 17.01.06 13:23 
Habt Dank für die Hilfe.

Bin nach einigem Suchen im Forum auf die Idee gekommen, das ganze mittels Tastensimulation (keybd_event) zu realisieren.

Das hat zwei entscheidende Vorteile:

1. Der Text wird ohne irgendein Zutun an die Cursorposition eingefügt.
2. es kann mit der Undo-Funktion des RichEdit rückgängig gemacht werden.