Delphi/Lazarus: Fully Expand or Collapse TreeView
Question by Guest | 2013-11-22 at 21:48
I am using a TTreeView in my program and I would like to write a function that automatically pops out all the items of the TreeView and another function that ensures that all branches are closed.
Various attempts to navigate through the TreeView and to use the Expand() command on several nodes have not led to a result.
I hope someone can help me here.
Related Topics
Delphi/Lazarus: How to set up a Link to a Website in an Application
Tutorial | 0 Comments
Delphi: Multiline Caption for TLabel (at Run Time and Design Time)
Tutorial | 1 Comment
Delphi/Lazarus: Command Line Parameter Tutorial Part 1: Sending
Tutorial | 0 Comments
Delphi/Lazarus: 3 Ways to round a Number to X Decimal Places
Tutorial | 7 Comments
Delphi: Global Treatment of Errors (Exceptions)
Tutorial | 0 Comments
Delphi/Lazarus: Delete selected Items from ListBox using DEL-Key
Tip | 3 Comments
PHP: Remove all empty elements from string array
Tip | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
Nothing is easier than that. You do not have to care about a function navigating through all items.
Just use
to unfold all branches and
to close all branches again.
2013-11-25 at 13:13
If you still want to use your Expand function, you can of course also do:
Or:
In case that the first item of the TreeView is set (otherwise there would be an exception), we are executing the Expand() operation on this first TreeView-Node. The "true" ensures that all other branches hanging on that node are expanded. If we pass "false", only the node is expanded, on which we have executed the Expand.
2013-11-26 at 22:08