Receiving drops

After you have decided which type of data you want your application or widget to accept, you tell everyone about this decision by calling the drag_dest_set() function on the target widget. Since we want to accept files, we need the text/uri-list target type:

Let's analyze the code:

The Gtk knows now that we accept files, but we didn't say what to do with them. The plan is to add all the dropped files to the tree, as children of the currently selected item.

If you drop some files from your favorite file manager, you will see that they are added to the list.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.