Autor Beitrag
dr. rom4o
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 59


TMT-Pascal, D3 Prof, C++Builder
BeitragVerfasst: Do 10.06.04 14:34 
Hallo,
wie kann ich die Cursorposition in einem memo bestimmen(per quelltext)??
ciao

_________________
Sei frei!!! ...doch eigentlich bist du es nie...denn Alles ist determiniert
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 10.06.04 15:55 
Hallo

2 Möglichkeiten:
- wenn du die anzahl der Zeichen weißt: selstart-eigenschaft setzen
- wenn du koordinaten hast:   memo1.CaretPos:=point(4,1); denk daran, das ab 0 beginnend gezählt wird.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
dr. rom4o Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 59


TMT-Pascal, D3 Prof, C++Builder
BeitragVerfasst: Do 10.06.04 17:39 
die erste Variante verstehe ich nicht, soeine Eigenschaft gibt es im memo nicht
und bei der zweiten Variante sagt er: Unidentifizierter Bezeichner: 'CaretPos'
hast du vielleicht eine andere Art vom memo?

dr. rom4o

_________________
Sei frei!!! ...doch eigentlich bist du es nie...denn Alles ist determiniert
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 10.06.04 19:38 
in deinem Profil steht D3, kann sein, das dort noch nicht alles dabei war. ich habe es aber nicht mehr installiert, kann nicht guggn.
mit der ersten Variante ist gemeint, das du z.B. zum 137. Zeichen springst, Variante 2 wäre Cursor 5. Zeile, 2. Zeichen, klar ?.
das setzen von caretpos wäre so, für die 2. Variante:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Button1Click(Sender: TObject);
var i,x,y: Integer;
begin
  x:= 5;
  y:= 4;
  i:=sendmessage(memo1.handle,EM_LINEINDEX,y,0)+x;
  sendmessage(memo1.handle,EM_SETSEL,i,i);
  Memo1.SetFocus;
end;


für die erste Variante reicht das
ausblenden Delphi-Quelltext
1:
  sendmessage(memo1.handle, EM_SETSEL, i, i);					

mit i als dein gewünschtes Zeichen, wo der cursor hin soll.
Probiers mal aus.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)