trichview.com

trichview.support




Re: Deleting paragaraph


Return to index


Author

Message

Sergey Tkachenko

Posted: 12/09/2003 1:15:59


var rve: TCustomRichViewEdit;

    i, StartItemNo, EndItemNo: Integer;

begin

  rve := RichViewEdit1.TopLevelEditor;

  // searching for the start of the next paragraph

  i := rve.CurItemNo+1;

  while (i<rve.ItemCount) and not rve.IsFromNewLine(i) do

    inc(i);

  if i=rve.ItemCount then

    exit; // that was the last paragraph

  StartItemNo := i;

  // searching for the end of the paragraph

  while (i+1<rve.ItemCount) and not rve.IsFromNewLine(i+1) do

    inc(i);

  EndItemNo := i;

  rve.SetSelectionBounds(StartItemNo, rve.GetOffsBeforeItem(StartItemNo),

    EndItemNo, rve.GetOffsAfterItem(EndItemNo));

  {

  // if you call SetSelectionBounds above, a empty line will be in place of

  // the deleted paragraph; if you want to delete it completely, use this:

  rve.SetSelectionBounds(StartItemNo-1, rve.GetOffsAfterItem(StartItemNo-1),

    EndItemNo, rve.GetOffsAfterItem(EndItemNo));

  }

  rve.DeleteSelection;

end;



>

> Hi,

> In addition to my question above, how do i delete a paragraph directly

below

> the present paragraph where the cursor is being currently positioned?

>

> Thanks.





Powered by ABC Amber Outlook Express Converter