Page 1 of 1

How do I place the cursor on a defined position?

Posted: Sat Nov 11, 2006 7:02 pm
by Crowbar
Hi,
with "RichViewEdit.GetCurrentLineCol(l,c)" safe I me the position of the cursor.
After calls from "RichViewEdit.Format" the cursor is on top.
After the "RichViewEdit.Format" command, the cursor should at the before saved position back.
So similarly:

Code: Select all

...
RichViewEdit.GetCurrentLineCol(l,c);
RichViewEdit.Format;
RichViewEdit.SetCurrentLineCol(l,c);  // <- ???
...
How do I place the cursor on a defined position?
Surely quite simply... ;)

Crowbar

Posted: Sun Nov 12, 2006 9:34 am
by Sergey Tkachenko
Format does not store the caret position, because Format is usually called when document is not formatted, so the caret position is undefined before its call.
If document is already formatted, why do you can Format? :)

Posted: Sun Nov 12, 2006 10:38 am
by Crowbar
I would like show and not show the SpecialCharacters:
RichViewEdit.Options:=RichViewEdit.Options-[rvoShowSpecialCharacters];
or
RichViewEdit.Options:=RichViewEdit.Options+[rvoShowSpecialCharacters];
The user can change this setting.

However, "Format" must be called after it. (?)
If I call "FormatTail", the cursor stay at the position, but the content of RichViewEdit is scrolling on bottom.

Crowbar

Posted: Sun Nov 12, 2006 1:31 pm
by Sergey Tkachenko
Yes, document should be reformatted after changing "show special characters" mode. Showing/hiding spaces and paragraph marks does require reformatting, but showing/hiding some Unicode characters (such as soft hyphens) requires reformatting.

Call RichViewEdit.Reformat.

Posted: Sun Nov 12, 2006 1:46 pm
by Crowbar
Call RichViewEdit.Reformat
Thanks, that is the solution! :)

Crowbar