Page 1 of 1
Scroll in View
Posted: Tue Jul 29, 2008 1:27 pm
by BernhardRoos
Hello,
if I have controls in TRichview, is it possible that TRichView automatically scrolls that a control is in view if I navigate through the controls for example with tab
At the moment the controls get the focus but I can't see it if the control is outside of the visible part of the Richview.
Best wishes
Bernhard
Posted: Tue Jul 29, 2008 5:18 pm
by LadyOfWood
I think you need to manually determinate that focus come to control and scroll TRichView to this control.
Posted: Wed Jul 30, 2008 6:08 am
by BernhardRoos
Is there an example how I can do this?
And is it possible to determine if it is necessary to scroll. I only want to scroll if the control is not in view.
Best wishes
Bernhard
Posted: Wed Jul 30, 2008 1:36 pm
by BernhardRoos
Is it possible to get the coordinates of the top line, which is in TRichView current visible?
Best wishes
Bernhard
Posted: Wed Jul 30, 2008 4:14 pm
by Sergey Tkachenko
Visible area:
Top: rv.VScrollPos*rv.VSmallStep
Bottom: Top+rv.ClientHeight
As for the control. To get vertical coordinate, it's better to use Control.Tag instead of Control.Top.
TRichView stores controls' Y coordinates in their Tag properties (Control.Tag). It's because too large control coordinates (> 30000 pixels) are not processed correctly by Windows. Control.Tag always contains the correct coordinate, Control.Top is limited to 0..30000 range.