SOLVED Drag and Drop between two UserArea

Hello everyone. I have created two UserAreas and I want to drag objects between them. Can you please tell me how to implement this?

def __init__(self):
    self.area1 = DraggingArea1()
    self.area2 = DraggingArea2()

def CreateLayout(self):
    self.AddUserArea(1000, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT)
    self.AttachUserArea(self.area1, 1000)

    self.AddUserArea(2000, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT)
    self.AttachUserArea(self.area2, 2000)
    return True

Hi @JohnSmith, we have separated your topic from Drag & Drop to Reorder in GUI since this is a new question. However for future reader, the code shown is a part of a code posted on the other topic.

There is the GeUserArea.HandleMouseDrag to start a drag operation, you can find an example in Drag&Drop an image in a gui field. However this is a drag operation handled by Cinema 4D so this is not possible to pass Python Object with it and there is nothing visible while the drag operation occurs.

So if you want to share python data from 2 GeUserArea the best way is through messages. The first GeUserArea 1 send a message to the dialog and then the dialog to forward the message to the GeUserArea2. Then in this message it is up to you to pass the correct data. You can pass a BaseContainer containing all your data. An example about message usage can be found in geuserarea_basic.

Cheers,
Maxime.

Hi @JohnSmith, we have separated your topic from Drag & Drop to Reorder in GUI since this is a new question. However for future reader, the code shown is a part of a code posted on the other topic.

There is the GeUserArea.HandleMouseDrag to start a drag operation, you can find an example in Drag&Drop an image in a gui field. However this is a drag operation handled by Cinema 4D so this is not possible to pass Python Object with it and there is nothing visible while the drag operation occurs.

So if you want to share python data from 2 GeUserArea the best way is through messages. The first GeUserArea 1 send a message to the dialog and then the dialog to forward the message to the GeUserArea2. Then in this message it is up to you to pass the correct data. You can pass a BaseContainer containing all your data. An example about message usage can be found in geuserarea_basic.

Cheers,
Maxime.

Hello @JohnSmith,

without any further questions and other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022.

Thank you for your understanding,
Ferdinand