Scroll in View

General TRichView support forum. Please post your questions here
Post Reply
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Scroll in View

Post 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
LadyOfWood
Posts: 71
Joined: Sat Aug 27, 2005 9:34 pm

Post by LadyOfWood »

I think you need to manually determinate that focus come to control and scroll TRichView to this control.
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post 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
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post by BernhardRoos »

Is it possible to get the coordinates of the top line, which is in TRichView current visible?
Best wishes
Bernhard
Sergey Tkachenko
Site Admin
Posts: 17534
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply