SelectCurrenParagraph?

General TRichView support forum. Please post your questions here
Post Reply
philip
Posts: 3
Joined: Fri Jun 11, 2010 1:23 pm

SelectCurrenParagraph?

Post by philip »

Hi,

There are SelectCurrentLine and SelectCurrentWord. Why not a SelectCurrentParagraph?. Or ... how can I do that?

Thank you.

Philip.
philip
Posts: 3
Joined: Fri Jun 11, 2010 1:23 pm

Post by philip »

Hi,

Ok I writted this and it works, but if the paragraph is in a table cell, then the whole table is selected, and I don't understand why.

Code: Select all

procedure WPSelectParagraph(RV: TCustomRichViewEdit);
var
  iFirst, iLast, i: integer;
begin
  iFirst := RV.CurItemNo;
  for i := iFirst to RV.ItemCount - 1 do
  begin
    if RV.IsParaStart(iFirst) then Break;
    Dec(iFirst);
  end;
  iLast := RV.CurItemNo + 1;
  for i := iLast to RV.ItemCount - 1 do
  begin
    if RV.IsParaStart(iLast) then Break;
    Inc(iLast);
  end;
  Dec(iLast);
  RV.SetSelectionBounds(iFirst, RV.GetOffsBeforeItem(iFirst),
                        iLast, RV.GetOffsAfterItem(iLast));
end;
Philip
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Add the line:

Code: Select all

RV := RV.TopLevelEditor;
at the beginning.
Post Reply