Page 1 of 1

Property Position TTeeScrollBar

Posted: Tue Jun 19, 2007 6:17 am
by 9233536
Hi,
if we add shapes or fill a tree or selected one shape we want to reposition the visible part of the tree programmatically. But it is impossible? The property position is read only. The help show:

'...When the user scrolls the scroll bar, the value of Position changes. Set Position to programmatically move the thumb tab of the scroll bar.'

How can I do that? Often scrolled the first shape (root) away although it is the only one. What is the reason? :?:

with regards
Joerg

Posted: Wed Jun 20, 2007 8:44 pm
by Tom
Hi Joerg,

You can move the scrollbar by code as in the following example:

Code: Select all

procedure TForm2.btnMoveHorzScrollBarClick(Sender: TObject);
var tmpPos : Integer;
begin
  tmpPos := (Tree1.HorzScrollBar.Max-Tree1.HorzScrollBar.Min) div 2;
  tmpPos := tmpPos - (Tree1.HorzScrollBar.PageSize div 2);
  Tree1.View3DOptions.HorizOffset := -tmpPos;
end;
Regards,
tom