Solved DRAGANDDROP_FLAG_FORBID

I want to create a MyRoot object under an object that is not allowed to be dragged by the user (like the Root under the CA object), I set DRAGANDDROP_FLAG_FORBID to the flag in the DragAndDrop struct of MSG_DRAGANDDROP, but I can still drag it out of the parent.
QQ录屏20210723224856_1.gif

This is the code in Message().

Bool MyRoot::Message(GeListNode* node, Int32 type, void* data) {
	if (type == MSG_DRAGANDDROP)
	{
		DragAndDrop* dnd = static_cast<DragAndDrop*>(data);
		if (dnd == nullptr)
			return false;
		if (dnd->flags & DRAGANDDROP_FLAG_SOURCE)
			dnd->flags |= DRAGANDDROP_FLAG_FORBID;
	}
	return true;
}

Hi @AiMiDi, MSG_DRAGANDROP will be received when the host receive a drag, I didn't tried but I guess only dialog can react to this message. In you case you will need to set the NBIT NBIT_NO_DD like so op.ChangeNBit(c4d.NBIT_NO_DD, c4d.NBITCONTROL_SET).

Cheers,
Maxime.

Hi @AiMiDi, MSG_DRAGANDROP will be received when the host receive a drag, I didn't tried but I guess only dialog can react to this message. In you case you will need to set the NBIT NBIT_NO_DD like so op.ChangeNBit(c4d.NBIT_NO_DD, c4d.NBITCONTROL_SET).

Cheers,
Maxime.