Drag and Drop - nicklikescoffee/UltimateUiPlugin GitHub Wiki
UltimateUI supports Drag-and-Drop for text and files via the Drop event.
How To Use Drag-and-Drop
You can subscribe to the Drop event by using UI Add Event. On the Control you will need to set the property AllowDrop to be True.
Some Controls already handle the Drop event and may not work for both files and text at this time. For example, the TextBox Control will not allow you to drop a file on it at this time.
Other Controls will allow you to drop files or text on them and then do something with the value. For example, the following code will allow you to drop a list of files (or some text) and then add the values to a ListBox:
plugin command("UltimateUI.dll", "UI Load XAML", "<ListBox x:Name=\"filesListBox\" AllowDrop=\"True\"/>", "True", "False", "False", "BaseLight", "Blue")
plugin command("UltimateUI.dll", "UI Add Event", "filesListBox", "Drop", "Dropped")
define Dropped(#_data) {
clear list(%files)
add list to list(%files,$list from text(#_data,$new line),"Delete","Global")
plugin command("UltimateUI.dll", "UI Set List", "filesListBox", %files)
}
To test this try highlighting several files and dragging them into the UI area. Or open up a notepad editor that allows dragging (like Notepad++) and create a list of items and try dragging them onto the UI area.
The value of the dropped item(s) will be sent to the first parameter of the command you choose to run. For an example refer to the code above. The #_data parameter is taking in the string sent to it and then we use that parameter to create a list and send it to the ListBox.