drag-and-drop

HTML5 Drag and Drop only images

十年热恋 提交于 2020-01-14 13:52:49
问题 What i'm trying to do is : if all the dragged files was images drop them, but if there was other file exstensions don't drop them, but drop the images only. Here's my try : HTML : <div id="dropzone"></div> Javascript : var dropzone = document.getElementById("dropzone"); dropzone.ondrop = function (e) { e.preventDefault(); e.stopPropagation(); var files = e.dataTransfer.files; for(x = 0; x < files.length; x = x + 1){ if(files[x].type.split("/")[0] == 'image') { console.log(files[x].name + "is

ItemTouchHelper - The drop is forced after the first jumped line

让人想犯罪 __ 提交于 2020-01-14 09:42:08
问题 I am using ItemTouchHelper and ItemTouchHelper.SimpleCallback to allow the user to reorder a vertical list Recycler View. The drag and drop works but the drop is forced after the first jumped line even though I don't leave up my finger from the dragged cell. Please find below the SimpleCallback : private void initSwipeAndDrap() { ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback( ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0) { //========== Swipe (Not

Dojo extending dojo.dnd.Source, move not happening. Ideas?

孤街浪徒 提交于 2020-01-14 03:59:46
问题 NOTICE: THIS IS SOLVED, I WILL PUBLISH THE SOLUTION HERE ASAP. Hey all, Ok... I have a simple dojo page with the bare essentials. Three UL's with some LI's in them. The idea si to allow drag-n-drop among them but if any UL goes empty due to the last item being dragged out, I will put up a message to the user to gie them some instructions. In order to do that, I wanted to extend the dojo.dnd.Source dijit and add some intelligence. It seemed easy enough. To keep things simple (I am loading Dojo

Drag and drop (replace) in HTML 5

狂风中的少年 提交于 2020-01-14 03:17:07
问题 i have menu from where can drag elements and drop into another div, it works. But how i can do the replacement of elements?? function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer.setData("text", ev.target.id); } function OnDragEnter (){ } function drop(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("text"); var nodeCopy = document.getElementById(data).cloneNode(true); nodeCopy.id = "newId"; ev.target.appendChild(nodeCopy); } 回答1: Try this: function

swing drag&drop file transferable?

元气小坏坏 提交于 2020-01-14 02:53:25
问题 I would like to drag and drop from my application into a system folder, so that when I drop an item, it shows up as a new file that represents the object I dragged. What DataFlavor should I use? 回答1: I figured it out myself. You just need to use DataFlavor.javaFileListFlavor and create a temporary file somewhere, and it all works well. Here's what worked for me: import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer

Forwarding drag & drop event to parent view

ε祈祈猫儿з 提交于 2020-01-13 19:01:32
问题 I have an application where I have one custom view which is derived from NSView. Within this view, there are several custom subviews, which are also derived from NSView. I want to implement a drag and drop behavior which allows URLs to be dropped onto the views. Everything is already working for the main view. So, actually I would have to implement dragging behavior handlers on the child-views and the parent-view class. The thing is, that I don't want to copy the complete handling code to all

Drag and Drop in Silverlight with F# and Asynchronous Workflows

只谈情不闲聊 提交于 2020-01-13 18:58:57
问题 I'm trying to implement drag and drop in Silverlight using F# and asynchronous workflows. I'm simply trying to drag around a rectangle on the canvas, using two loops for the the two states (waiting and dragging), an idea I got from Tomas Petricek's book "Real-world Functional Programming", but I ran into a problem: Unlike WPF or WinForms, Silverlight's MouseEventArgs do not carry information about the button state, so I can't return from the drag-loop by checking if the left mouse button is

Detect drag and drop operations in an external application using .Net

痞子三分冷 提交于 2020-01-13 16:59:06
问题 I need to detect drag and drop operations in an external application , is it possible? I thought of writing a hook to detect these operations. Can anybody point me in the right direction as far as which messages or api functions I could attempt to hook to detect the Drag & Drop events? I want to do this in C#. Thanks in advance. 回答1: There are two obvious paths you can go down to attempt this. The first, is to hook the OLE functions involved in mediating drag/drop operations. This assumes

JavaFX OnDragDropped Not Registering

谁说我不能喝 提交于 2020-01-13 10:16:17
问题 I am trying to drag and drop labels on top of each other. I have a list of labels called starsAndBars, and every label has this called on it as it is created: private void giveDragAndDropProperties(Label label) { //Enable drag actions to pick up the label label.setOnDragDetected(new EventHandler<MouseEvent>() { public void handle(MouseEvent event) { System.out.println("Drag and drop started!"); Dragboard db = label.startDragAndDrop(TransferMode.ANY); ClipboardContent content = new

How to drag & drop lots of files without taxing system resources?

爱⌒轻易说出口 提交于 2020-01-13 09:56:05
问题 One of the features that the program that I'm working on is the ability to drag objects from its main window and drop them onto Windows Explorer as files. To do this, we override COleDataSource::OnRenderGlobalData() and, when the format is CF_HDROP , we save each object as a file. This works fine when the number of objects is small. However, as we're now working on supporting enterprise level amounts of objects, we're seeing big delays, sometimes leading to hangs or eventual crashes, when the