DragAndDrop system problem


12-01-2011 04:54:33

I am making my own drag and drop system in MyGUI. I listen for eventMouseDragged, then detach the widget and put it in the DragAndDrop layer. Then I move the widget so it stays centered on the cursor.

When I drag the widget over another one, it is impossible to know that I am over it since the widget that is dragging takes mouse focus. How can I fix this? Can I make the image follow the cursor without taking mouse focus?



12-01-2011 05:28:43

partially fixed the problem by using

Widget* receiver = LayerManager::getInstance().getWidgetFromPoint(_left, _top);
receiver->eventMouseMove(image, _left, _top);

in eventMouseDragged for the dragged object. In eventMouseMove for the receiver I highlight the widget to show that you can drop the icon there.

However, I need to know when I am no longer over a widget (so I can make it not highlight).


12-01-2011 18:35:58

DDContainer have such event, so you should either use it instead of receiver widget or create it as child of reciever widget. You probably need eventChangeDDState