How to reliably scroll Virtual TreeView to the bottom?

ScrollIntoView works well for me. You can also try tree1. FocusedNode := tree1.GetLast.

ScrollIntoView works well for me. You can also try tree1. FocusedNode := tree1.

GetLast; Are you setting custom node height in OnMeasureItem event? If it doesn't work, try to set tree's DefaultNodeHeight to the bigger value and in OnMeasureItem event change it to lower. I noticed that tree recalculates scrollbar's length better that way.

Thanks Linas. Yes, I'm setting custom height for each node in OnMeasureItem event base on the node contents. Setting 'tree1.

FocusedNode' does not work. I'll try what you said about setting the larges height for all nodes then adjust the values. – Edwin Yip May 15 '10 at 19:26 The second approach you suggested works!

It seems that Virtual Treeview uses DefaultNodeHeight when doing calculation during a scroll operation. – Edwin Yip May 15 '10 at 19:43 That's correct, Edwin. The alternative would be for the control to initialize every node in the tree, even the ones that haven't had to be visible yet.

That can be time-consuming. – Rob Kennedy May 16 '10 at 5:39.

This also should work: tree1. TopNode := tree1.GetLast.

Thanks Straveu. It does not work also... PS. I can get the treeview completed printed if I manually (not programmatically) scroll down to the last node.

– Edwin Yip May 15 '10 at 19:32.

I've had the same problem working with TVirtualDrawTree's. You have to make sure that node heights are computed before the tree actually scrolls. This is what I do: 1.

- Add this code to the OnInitNode event so that the tree knows that the height of the new node must be computed: Node. States := node. States + vsMultiline - vsHeightMeasured; 2.

- In the OnMeasureItem, if you can't compute the height (e.g. Node not initialized yet), make sure you tell the tree to repeat the call when needed: In the OnMeasureItem event handler: If (Node = Nil) Or (Node = tree. RootNode) Then Begin Exclude(Node. States, vsHeightMeasured); Exit; End; NodeData := tree.

GetNodeData(Node); If (NodeData = Nil) Or (NodeData^. XMLNode = Nil) Then Begin Exclude(Node. States, vsHeightMeasured); Exit; End; Try // Code to measure node height here.

Except Exclude(Node. States, vsHeightMeasured); End; I hope it helps you.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions