Unfolded TreeView

On 11/10/2017 at 13:40, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R17 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
Hello.

I add a tree view custom gui in a dialog.
Is there any option to initialize the tree as unfolded ?

Thank you!

On 12/10/2017 at 01:19, xxxxxxxx wrote:

The folded state is define by the IsOpen function.
Simply make return to false for the first time, then after get the obj.GetBit(c4d.BIT_OFOLD)
And in your Open function which is trigger when something is open/closed
make something like
        if onoff:
            obj.SetBit(c4d.BIT_OFOLD)
        else:
            obj.DelBit(c4d.BIT_OFOLD)

Of course this method work for any BaseList2D but for any customDataType simply make a Bool member variable who gonna store the state of the folding.

Additionnaly I really suggest you to read thoses following blog post about tree view
TreeView made simple - Part 1
Treeview made simple – Part 2

On 12/10/2017 at 02:04, xxxxxxxx wrote:

Hi,

basically you define yourself the fold state of every node in the tree view by the return value of TreeViewFunctions::IsOpened(). Its counterpart is TreeViewFunctions::Open(), which requests to fold or unfold a certain node. It's on you to work with these. For example always returning true from IsOpened() will result in an unfolded and unfoldable tree.

And then there are TreeViewCustomGui::MakeVisible() and TreeViewCustomGui::ShowObject(), which make use of above functions to reveal a certain node in the tree.

Edit: Ooopsy, gr4ph0s was faster...