Page 1 of 1

[Solved] Force position of vertical scrollbar ?

Posted: Thu Nov 22, 2007 1:58 pm
by 9343260
Hello,

Is it possible to force the position of the vertical scrollbar ? Sometimes i must build again all my treeview, and i would like to show the treeview at the same position as before it has been rebuilt. :?:

Posted: Tue Jan 08, 2008 3:21 pm
by 9343260
To solve this problem, I would need a function like TTreeNode.MakeVisible() which doesn't exist in TeeTree (as TTreeNodeShape don't inherit from TTreeNode).

Still no support about this problem ?

Posted: Mon Jan 14, 2008 9:54 pm
by Tom
Hi,

You can move the scrollbars to a position with the VertOffset and/or HorizOffset of the View3DOptions.

So before rebuilding, you could store these values in temporary variables. After rebuild, you assign them back to VertOffset and HorizOffset.

Code: Select all

procedure TForm2.btnRebuildClick(Sender: TObject);
var tmpH, tmpV: Integer;
begin
  tmpH := Tree1.View3DOptions.HorizOffset;
  tmpV := Tree1.View3DOptions.VertOffset;
  Tree1.View3DOptions.HorizOffset := 0;  //Simulate rebuild
  Tree1.View3DOptions.VertOffset := 0;
  Tree1.View3DOptions.HorizOffset := tmpH;
  Tree1.View3DOptions.VertOffset := tmpV;
end;
Regards,
Tom.

Posted: Tue Jan 15, 2008 8:19 am
by 9343260
Hi tom,

Thanks for the answer, it works well. User just sees the scrollbar "blinking" because it jumps to the position 0 and then to VertOffset, but it is still far less annoying than before.