Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Unfolded TreeView

 Post Reply Post Reply
Author
Message
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 300
Post Options Post Options   Quote peterakos Quote  Post ReplyReply Direct Link To This Post Topic: Unfolded TreeView
    Posted: 2017 Oct 11 at 1:40pm

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!
Back to Top
gr4ph0s View Drop Down
Member
Member


Joined: 2015 Jul 07
Location: France
Online Status: Online
Posts: 366
Post Options Post Options   Quote gr4ph0s Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Oct 12 at 1:19am
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


Edited by gr4ph0s - 2017 Oct 12 at 1:26am
Technical lover.
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1497
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Oct 12 at 2:04am
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...


Edited by Andreas Block - 2017 Oct 12 at 2:05am
Cheers,
Andreas
SDK Support Engineer
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.