Good afternoon to all.
how is the best way to set the caret position?
For example, how is possible to set the first line of the document with X:=40 and Y:=25 ?
I'm not able to set caret position and insert text, this piece of code does not work
MM1.Caret.XY:=(Point(40,30));
MM1.AddText('First Line .....');
MM1.AddLineBreak;
// Second Line ..
MM1.Caret.XY:=(Point(40,MM1.Caret.XY.Y));
MM1.AddText('Second Line .....');
MM1.AddLineBreak;
But the result is
and Caret.XY.Y is always 0.
Can you have any suggestion??
Thank's
Daniele
You can set the caret position at a specific character position in the same way as you can do with the standard VCL TRichEdit , i.e. AdvRichEditor.SelStart: integer; Set AdvRichEditor.SelLength: integer to zero if no text needs to be selected.
Good afternoon Bruno,
i tried with this code
MM1.SelStart:=35;
MM1.SelLength:=0;
MM1.AddText('First Line .....');
MM1.AddLineBreak;
// Seconda Linea ..
MM1.SelStart:=35;
MM1.SelLength:=0;
MM1.AddText('Second Line .....');
MM1.AddLineBreak;
with this result is this ..
So the X position (start position) is always 0 (when i add the first line the richmemo is empty).
I've used beginupdate and endupdate without any result.
How is possibile set the Y position? (for example start the first line with an Y offset).
Have you any more suggestion??
Thank's for your help
Regards
Daniele
I do not understand what you try to do with this code.
You set SelStart twice to 35 with what purpose?
SelStart is expected to be a value between 0 and total length of the text in the TAdvRichEditor