THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/04/2004 at 01:46, xxxxxxxx wrote:
Cinema 4D Version: 8.207
Platform: Windows ;
Language(s) : C++ ;
What we have: A dialog with a tree, each tree item is a struct, one of the structs attributes is a pointer to a material
What we want to do: If we take a tree item and put it on an object with dragndrop, we want the material belonging to the tree node to be dropped on the object.
GetDragType: Ok, this one is called it I start a drag. Dragtype should be DRAGTYPE_BROWSER_MATERIAL in our case. But if I do the drop, I get an access violation. I even understand this, I say the type is material, but the data that is dropped to the object surely is just the treenode, and not the material. How do I set the material to be the drop data? obj is a pointer to the tree object...but what is user data?
SetDragObject: This one did sound good, set the drag object to obj. I thought, well with this one I can have influence on what is to be dropped...gut the function is never called.
How to solve our problem? And what is SetDragObject for?
On 01/05/2004 at 17:46, xxxxxxxx wrote:
You have to use DRAGTYPE_ATOMARRAY if your tree doesn't store atoms directly. Then GenerateDragArray() will be called, so that you can add the real material to it.
SetDragObject() is called once a drag has been confirmed. You don't really have much control there, it's just to let you know which object is being dragged if it would affect your decision in AcceptDragObject() if it's your own object. For dragging to C4D it won't be necessary, afaics.
On 03/05/2004 at 07:42, xxxxxxxx wrote:
Only one problem left: If I do a drag to C4D, I want to drag the material behind the tree item. But if I do a drag inside my tree, I only want to drag the tree item itself, before we did that with DRAGTYPE_COMMAND. But when GetDragType is called, I dont know if the following drag will be to c4d or my tree. So I receive a material in my tree, and have to chance to get back from the material to the tree node. Is there also a smart solution for this?
On 04/05/2004 at 05:52, xxxxxxxx wrote:
Perhaps you could use SetUserID/SetUserData for this, if you don't want to search the tree. You should also store the "obj" you get in SetDragObject() in a variable of your userdata. Then you check "dragobject" against this object in AcceptDragObject() and InsertObject() to determine if the current drag is from your manager (dragobject == the stored object) or from outside.