How can I add drag and drop functionality to a label element


#1

It’s a cool engine!

I am using it to develop a simulator.

I want to add the drag and drop functionality to my gui, e.g., label, which will work as file manager (load files).

Can anybody share some code snippets or give me some hints on it!

thanks!


#2

You can take a look at this GUI element used by the editor: https://github.com/BearishSun/BansheeEngine/blob/74b63f92ac911d5e76956f4b0200ba9a300837d2/Source/EditorCore/GUI/BsGUIDropButton.cpp

Note this only handles the drag and drop events initiated from the framework itself, not things like drag and dropping a file from the OS. To handle OS drag and drop events you’ll need to incorporate the DropTarget object.


#3

Nice, I will try it out! thank you so much!