Page 1 of 1
Scroll selection to center after calling SearchText method
Posted: Wed Nov 29, 2017 9:10 am
by saeid2016
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?
Re: Scroll selection to center after calling SearchText method
Posted: Sat Dec 02, 2017 1:02 pm
by Sergey Tkachenko
You can implement it using undocumented methods:
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;
Re: Scroll selection to center after calling SearchText method
Posted: Sun Dec 03, 2017 6:40 am
by saeid2016
Thanks a lot