[Solved] Force position of vertical scrollbar ?

TeeTree VCL for Borland Delphi and C++ Builder.
Post Reply
bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

[Solved] Force position of vertical scrollbar ?

Post by bertrod » Thu Nov 22, 2007 1:58 pm

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. :?:
Last edited by bertrod on Tue Jan 15, 2008 8:20 am, edited 1 time in total.

bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

Post by bertrod » Tue Jan 08, 2008 3:21 pm

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 ?

tom
Advanced
Posts: 211
Joined: Mon Dec 01, 2003 5:00 am
Contact:

Post by tom » Mon Jan 14, 2008 9:54 pm

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.

bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

Post by bertrod » Tue Jan 15, 2008 8:19 am

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.

Post Reply