copy text from the cursor
copy text from the cursor
how to do to select all the text from the point of the strokes down?
Re: copy text from the cursor
hello, I insist, how can I do to copy the text programmatically from the point where the cursor is located by copying all the text below the cursor?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: copy text from the cursor
Sorry for the delay.
And sorry, I do not understand your question.
Do you want to copy to the Clipboard all text from the blinking caret position and to the end of the document?
Or may be you want to copy a word below the pointer?
Or something else?
And sorry, I do not understand your question.
Do you want to copy to the Clipboard all text from the blinking caret position and to the end of the document?
Or may be you want to copy a word below the pointer?
Or something else?
Re: copy text from the cursor
exactly, i need to copy all the text from the blinking cursor down. example:
AAAAAAAAAA
BBBBBBBBBB
CCCCCCCCC
DDDDDDDDD
FFFFFFFFFFF
GGGGGGGG
suppose user placed the cursor at the beginning of "ACPC" I need to copy to a secondary TSrichView from "CCC ..." to "GGGG ..."
or if there are more pages after "GGGG" to copy as well.
thanks
AAAAAAAAAA
BBBBBBBBBB
CCCCCCCCC
DDDDDDDDD
FFFFFFFFFFF
GGGGGGGG
suppose user placed the cursor at the beginning of "ACPC" I need to copy to a secondary TSrichView from "CCC ..." to "GGGG ..."
or if there are more pages after "GGGG" to copy as well.
thanks
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: copy text from the cursor
I suggest to select the fragment that you need to copy temporarily, then restore the original selection.
To prevent flickering, do it in BeginUpdate/EndUpdate.
Let we have rve: TRichViewEdit.
To prevent flickering, do it in BeginUpdate/EndUpdate.
Let we have rve: TRichViewEdit.
Code: Select all
uses
RVLinear;
var
SelStart, SelLength: Integer;
RVGetSelection(rve, SelStart, SelLength);
rve.BeginUpdate;
rve.SetSelectionBounds(rve.CurItemNo, rve.OffsetInCurItem, rve.ItemCount-1, rve.GetOffsAfterItem(rve.ItemCount-1));
rve.CopyDef;
RVSetSelection(rve, SelStart, SelLength);
rve.EndUpdate;
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: copy text from the cursor
If you need to copy not to the clipboard but to another editor rve2:
The same code for ScaleRichView, copying from srv to srv2:
Code: Select all
uses
RVLinear;
var
SelStart, SelLength: Integer;
Stream: TMemoryStream;
Stream := TMemoryStream.Create;
RVGetSelection(rve, SelStart, SelLength);
rve.BeginUpdate;
rve.SetSelectionBounds(rve.CurItemNo, rve.OffsetInCurItem, rve.ItemCount-1, rve.GetOffsAfterItem(rve.ItemCount-1));
rve.SaveRVFToStream(Stream, False);
RVSetSelection(rve, SelStart, SelLength);
rve.EndUpdate;
Stream.Position := 0;
rve2.LoadRVFFromStream(Stream);
rve2.Format;
Stream.Free;
Code: Select all
uses
RVLinear;
var
SelStart, SelLength: Integer;
Stream: TMemoryStream;
Stream := TMemoryStream.Create;
RVGetSelection(srv.RichViewEdit, SelStart, SelLength);
srv.CanUpdate := False;
with srv.RichViewEdit do
SetSelectionBounds(CurItemNo, OffsetInCurItem, ItemCount-1, GetOffsAfterItem(ItemCount-1));
srv.RichViewEdit.SaveRVFToStream(Stream, False);
RVSetSelection(srv.RichViewEdit, SelStart, SelLength);
srv.CanUpdate := True;
Stream.Position := 0;
srv2.RichViewEdit.LoadRVFFromStream(Stream);
srv2.Format;
Stream.Free;
Re: copy text from the cursor
please friend, I insist that you read and see the examples I gave you, I need to copy only where the cursor is flashing on the screen until the end and not the entire text, I think the translation is getting bad because I don't think it you haven't understood.
"your code copies the entire text from and not just that of the blinking cursor down."
"your code copies the entire text from and not just that of the blinking cursor down."
Re: copy text from the cursor
in my example the cursor is positioned blinking at the beginning of the line "CCCCCCCCC"
I need a code that copies from the cursor line to the end. in this case the copy would be:
"CCCCCCCCC
DDDDDDDDD
FFFFFFFFFFF
GGGGGGGG "
I need a code that copies from the cursor line to the end. in this case the copy would be:
"CCCCCCCCC
DDDDDDDDD
FFFFFFFFFFF
GGGGGGGG "
Re: copy text from the cursor
the first code worked well, the others were not successful, in any case it was resolved, thanks.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: copy text from the cursor
All code fragments in this topic select and copy text starting from the blinking caret and to the end of the document, as you asked.
If you have problems with the code I posted, please let me know what's wrong exactly.
If you have problems with the code I posted, please let me know what's wrong exactly.