General TRichView support forum. Please post your questions here
Sergey Tkachenko
Site Admin
Posts: 17557 Joined: Sat Aug 27, 2005 10:28 am
Contact:
Post
by Sergey Tkachenko » Tue Apr 30, 2013 4:14 pm
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;
Sergey Tkachenko
Site Admin
Posts: 17557 Joined: Sat Aug 27, 2005 10:28 am
Contact:
Post
by Sergey Tkachenko » Tue Apr 30, 2013 4:19 pm
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;
Sergey Tkachenko
Site Admin
Posts: 17557 Joined: Sat Aug 27, 2005 10:28 am
Contact:
Post
by Sergey Tkachenko » Tue Apr 30, 2013 4:20 pm
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;