Page 1 of 1
How to set cursor at the end of document ?
Posted: Wed Apr 19, 2006 12:05 am
by Marsianin
I want to implement 'entire scope' search (which is not implemented for RichViewEdit) and need to set cursor to the end of the document when direction is UP.
I'm using RVSetLinearCaretPos but don't know how to get the last symbol position number.
Posted: Wed Apr 19, 2006 7:08 pm
by Sergey Tkachenko
rve.SetSelectionBounds(rve.ItemCount-1, rve.GetOffsAfterItem(rve.ItemCount-1), rve.ItemCount-1, rve.GetOffsAfterItem(rve.ItemCount-1))
Posted: Wed Apr 19, 2006 8:20 pm
by Marsianin
And how to use it ?
And how to get the last character number in the text ? Will it be rve.ItemCount-1 ?
Posted: Thu Apr 20, 2006 2:35 am
by Marsianin
Just read the help
Code: Select all
var
ItemNo, Offs: Integer;
...
ItemNo := MyRichViewEdit.ItemCount-1;
Offs := MyRichViewEdit.GetOffsAfterItem(ItemNo);
MyRichViewEdit.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);
Same code as you posted above. Thanks.
Posted: Thu Apr 20, 2006 3:12 am
by Marsianin
But another one question.
Is there a way to perform search in all document without changing position of the caret ?
Posted: Thu Apr 20, 2006 7:15 pm
by Sergey Tkachenko
What do you mean by "without changing position of the caret"? Not changed if nothing is found, or not changing at all?
May be you are searching for something like this:
http://www.trichview.com/forums/viewtopic.php?t=57
Could not make this work
Posted: Mon Jul 23, 2007 1:28 pm
by recbeat
Hello,
I tried the code you suggested but to no avail. I got 'List index out of bounds (-1)' error. I added one item into RichView to test this in order to add text to the end of the document:
var
ItemNo, Offs: Integer;
...
ItemNo := MyRichViewEdit.ItemCount-1;
Offs := MyRichViewEdit.GetOffsAfterItem(ItemNo);
MyRichViewEdit.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);
What is wrong? I'm trying this on Delphi 7.
Thanks for any help.
Posted: Tue Jul 24, 2007 2:44 pm
by Sergey Tkachenko
May be your RichViewEdit was not formatted?
Posted: Thu Jul 26, 2007 12:14 pm
by recbeat
Hello Sergey,
Yes, the 'Format' call figured this out. Thanks!