Scroll selection to center after calling SearchText method
Posted: Wed Nov 29, 2017 9:10 am
Hello, The SearchText method selects the found text and scrolls it to view. Is it possible to scroll the selected text to center of RichViewEdit?
Support forums for TRichView, ScaleRichView, Report Workshop and RVMedia components
https://www.trichview.com/forums/
Code: Select all
// searching for 'a' and centering the found line vertically
var
rve: TCustomRichViewEdit;
ItemNo, Offs: Integer;
begin
RichViewEdit1.BeginUpdate;
if RichViewEdit1.SearchText('a', [rvseoDown]) then
begin
rve := RichViewEdit1.TopLevelEditor;
ItemNo := rve.CurItemNo;
Offs := rve.OffsetInCurItem;
rve.RVData.Item2DrawItem(ItemNo, Offs, ItemNo, Offs);
RichViewEdit1.ScrollToDrawItem(rve.RVData, ItemNo, True);
end;
RichViewEdit1.EndUpdate;
end;