How to select a paragraph on several lines. Paragraphs are limited by number and not by #10 + *#13? Selection fear to be by clicking or by mouse flying over the paragraph.
Asked
Active
Viewed 2,170 times
0
-
@Andreas Rejbrand, paragraphs are quite formal for TRichEdit. However, i fear flying mice and tranlation robots. – Premature Optimization Sep 26 '11 at 21:12
-
@Downvoter: I am sorry. I guess I should have known that. – Andreas Rejbrand Sep 26 '11 at 21:14
-
@downvoter I think Andreas was asking Mostafa what was meant by paragraphs are limited by number. This presumably is some definition of paragraphs that is not coincident with the rich text definition. – David Heffernan Sep 26 '11 at 21:36
-
@David Heffernan, good point. – Premature Optimization Sep 26 '11 at 22:24
-
@Andreas Rejbrand, please accept my apologies, i was interpreting the question text (i'm convinced what question text was produced by machine translation and robot consealed some sense from us). Its better to figure out what OP meant by paragraphs-with-numbers (bullets?) first. – Premature Optimization Sep 26 '11 at 22:24
2 Answers
0
Basically if you use SelStart and SelLength public properties of your TRichEdit, you can select whatever text you want in your richedit control.
So, you can break your text apart as you want, paragraphs or not, and then just select programmatically a slice of it.

haimg
- 4,547
- 35
- 47
0
{********************************************************************}
// Nombre de la funcion: TI2FStrings.GetCursorSQL
// Explicación: Obtiene el párrafo donde está situado el cursor.
//
// Usuario Fecha Modificación
// ------------ ---------- ------------------------------------------
// drodriguez 11/08/2005 Creación
{********************************************************************}
class function TI2FStrings.GetCursorSQL(Text: string; CursorPos: Integer): string;
var
LastPos, iPos: Integer;
IniPos, FinPos: Integer;
Begin
iPos:= 1;
Repeat
LastPos:= iPos;
iPos:= PosEx(#13#10#13#10, Text, iPos);
if (iPos <> 0) then Inc(iPos, 2);
until (iPos = 0) or (CursorPos < iPos - 1);
if (iPos = 0) then iPos:= Length(Text)
else Dec(iPos, 2);
FinPos:= iPos;
IniPos:= LastPos;
Result:= Trim(Copy(Text, IniPos, FinPos - IniPos + 1));
end;
This is to get an SQL from an TMemo where every SQL is separated by an empty line. Just replace #13#10#13#10
by #13#10
.

Dani Rodríguez
- 72
- 3
- 13