I have seen the excellent post of Maxime about creating a Treeview.
See https://plugincafe.maxon.net/topic/10654/14102_using-customgui-listview/2
There is an Add button, but now I want to add it as a child.
I added a Insert Under button with following code in Command().
if id == 1002:
# Insert Under
tex = TextureObject("Inserted under first item.")
first = self._listView.GetFirst(self._treegui, self._listView)
#InsertObject(self, root, userdata, obj, dragtype, dragobject, insertmode, bCopy):
self._listView.InsertObject(self._treegui, self._listView, first, c4d.DRAGTYPE_FILENAME_OTHER, tex, c4d.INSERT_UNDER, True)
# Refresh the TreeView
self._treegui.Refresh()
And in class ListView(c4d.gui.TreeViewFunctions) I added
def GetFirst(self, root, userdata):
rValue = None if not self.listOfTexture else self.listOfTexture[0]
return rValue
def InsertObject(self, root, userdata, obj, dragtype, dragobject, insertmode, bCopy):
return True
But nothing is inserted.
I think it is because of InsertObject(), because nothing is inserted in the _listView.
So, how to insert it as a child?
-Pim