Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi,
Upon RMB a TreeView item, you'll get the default Remove and Remove All. I want to remove them but I'm having problem doing so.
TreeView
Remove
Remove All
Here is the working code so far:
def CreateContextMenu(self, root, userdata, obj, lColumn, bc): bc = None # Delete the existing base container bc = c4d.BaseContainer() # Create a blank one bc.SetString(1231245, "Hello World!") # Add a new entry
Regards, Ben
As said in the documentation here you have to remove those entry in the basecontainer provided. You can override bc content like this.
for that you have several option
# one of those solution should work # 1 - flush the BaseContainer bc.FlushAll() # 2 - Remove data using our API bc.RemoveData(c4d.ID_TREEVIEW_CONTEXT_REMOVE) bc.RemoveData(c4d.ID_TREEVIEW_CONTEXT_RESET) # 3- Remove data using Python del (bc[c4d.ID_TREEVIEW_CONTEXT_REMOVE]) del (bc[c4d.ID_TREEVIEW_CONTEXT_RESET])
Cheers, Manuel
@m_magalhaes
Thanks! It works as expected