Page 1 of 1

Posted: Tue Apr 30, 2013 4:14 pm
by Sergey Tkachenko
Moving to the end of line requires using undocumented methods and properties

Code: Select all

uses CRVFData, RVERVData;
procedure GoToEndOfLine(rve: TCustomRichViewEdit);
var DItemNo, DOffs, ItemNo, Offs: Integer;
    RVData: TRVEditRVData;
begin
  RVData := TRVEditRVData(rve.TopLevelEditor.RVData);
  DItemNo := RVData.CaretDrawItemNo+1;
  while (DItemNo<RVData.DrawItems.Count) and not RVData.DrawItems[DItemNo].FromNewLine do
    inc(DItemNo);
  dec(DItemNo);
  DOffs := RVData.GetOffsAfterDrawItem(DItemNo);
  RVData.DrawItem2Item(DItemNo, DOffs, ItemNo, Offs);
  RVData.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
end;

Posted: Tue Apr 30, 2013 4:19 pm
by Sergey Tkachenko

Code: Select all

procedure GoToEndOfPara(rve: TCustomRichViewEdit);
var ItemNo, Offs: Integer;
begin
  rve := rve.TopLevelEditor;
  ItemNo := rve.CurItemNo+1;
  while (ItemNo<rve.ItemCount) and not rve.IsParaStart(ItemNo) do
    inc(ItemNo);
  dec(ItemNo);
  Offs := rve.GetOffsAfterItem(ItemNo);
  rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
end;

Posted: Tue Apr 30, 2013 4:20 pm
by Sergey Tkachenko

Code: Select all

procedure GoToEndOfDoc(rve: TCustomRichViewEdit);
var ItemNo, Offs: Integer;
begin
  ItemNo := rve.ItemCount-1;
  Offs := rve.GetOffsAfterItem(ItemNo);
  rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
end;