Thanks, sounds a bit complicated, so I have to give it some thoughts.
For now, it is enough.
Yes, it works great.
does HandleMouseDrag() now replace MouseDrag(), MouseDragStart() and others.
how to get the mouse coordinates where the drag started.
Or better, I will have some pictures in the UA, how to know which picture is being dragged&dropped?
where and when to call self.SetDragDestination(c4d.MOUSE_CROSS).
Just before HandleMouseDrag in InputEvent()?
HandleMouseDrag() is in the UA InputEvent().
For which message ID should I look before starting HandleMouseDrag().
In my InputEvent() function also other messages are handled.
I have User Area with some images.
Now I want to drag&drop one of those images in the UA to a Gui field, so I can get the filename of the chosen image.
Something like this.
Hope you can help me with a example.
I implemented a treeview and it is working great.
I like to know whether it is possible to Drag&Drop an object (in this case a link to a image file) from the treeview to (for example) the color channel of a material in the Material Editor?
I implemented a treeview and it is working ok.
Now I want to add the right click function.
Right click opens a context menu, so I need to add my own menu item to the context menu. That is working too.
Except I do not know how to remove the the default context menu items (Remove and Remove All).
I read this in the manual.
Thanks, great explanation!
One small issue. Delete doesn't work because objParent' is not defined.
Traceback (most recent call last): File "scriptmanager", line 251, in DeletePressed NameError: global name 'objParent' is not defined
Here the code that, I think, solves the issue:
def DeletePressed(self, root, userdata): "Called when a delete event is received." for tex in reversed(list(TextureObjectIterator(self.listOfTexture))): if tex.IsSelected: objParent = tex.GetParent() # Added listToRemove = objParent.GetChildren() if objParent is not None else self.listOfTexture listToRemove.remove(tex)
Ok, after some more reading I now understand that I should insert the object in the listview myself.
def InsertObject(self, root, userdata, obj, dragtype, dragobject, insertmode, bCopy): self.listOfTexture.append(dragobject) return True
But now it is inserted at the end (makes sense, because I use an append()).
My question is how to insert the new object under another one?
Something like this.
I am trying to make treeview of a folder with its subfolders and files.