How do I place the cursor on a defined position?

General TRichView support forum. Please post your questions here
Post Reply
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

How do I place the cursor on a defined position?

Post 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
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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? :)
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

Post 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
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

Post by Crowbar »

Call RichViewEdit.Reformat
Thanks, that is the solution! :)

Crowbar
Post Reply