drag-and-drop

How can I make different shapes of a canvas draggable and particular area of it droppable in the same canvas

有些话、适合烂在心里 提交于 2019-12-10 12:16:25
问题 I want to create a Canvas in which there will be two areas (Left and right), Left panel will contain some shapes which will be draggable(static as well) and on the right side I would be able to drop them, but I am facing following problem, I am not able to make the shapes which i draw on the left side, draggable, because there is no id associated with them. I do not know how to make some particular area droppable. Here is code to visualize what I am trying to achieve- <body> <canvas id=

Save HTML5 canvas contents, including dragged-upon images

£可爱£侵袭症+ 提交于 2019-12-10 11:56:24
问题 I'm using a canvas to load a background image, and then, using jQuery UI, I call the droppable() function on the canvas and draggable() on a bunch of PNG images on the screen (that are not in the canvas). After the user drags one or more images on the canvas, I allow him to save the contents to a file using the following function: function saveCanvas() { var data = canvas.toDataURL("image/png"); if (!window.open(data)) { document.location.href = data; } } This successfully open another window

Dragging files into rich textbox to read text in file

a 夏天 提交于 2019-12-10 11:38:37
问题 I'm having a problem with dragging and dropping files onto a richTextBox, every time I drag a text file onto it, it turns into a picture of the text file with its name under it. Double click the file and it opens up using the system default application (ie notepad for text files, etc). basically its making shortcuts in the richTextBox, when i want it to read the text in the file. Based on this code, the text from the file should extract into richTextBox1 class DragDropRichTextBox :

jQuery Drag & Drop without Destroying dragged item

邮差的信 提交于 2019-12-10 11:35:57
问题 I am having some difficulty with the following and need a bit of guidance in how this can be achieved (simply). Using jQuery, how can I drag one object into a container, register it for events, and leave the original dragged item in place. This is very difficult to explain, so the best I can give is a site with a working example: enter link description here I am familiar with using draggable, and droppable, and registering an original container, however on drop, the dragged object is moved

current working directory in a vbscript invoked by a drag & drop operation

北城以北 提交于 2019-12-10 11:23:09
问题 When I was trying to get elevated rights for my batch script, when I found two related SO questions How to request Administrator access inside a batch file How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required? ...that led to answers that worked partially. For some reason, I had issues with command line passing for file path arguments containing spaces within the VBS script, so I tried to break the solution into 3 parts and concentrated on the

Drag file into Access, how to check the file details?

拜拜、爱过 提交于 2019-12-10 11:09:24
问题 I like to drag a file from Windows Explorer or an attachment from an Outlook mail into MS-Access. I discovered already I can use the Access BoundObjectFrame (https://msdn.microsoft.com/en-us/library/office/ff835725.aspx) as a target to drag and drop files from the Windows Explorer. And with the following code I see that something was dropped into the field: Private Sub OLE1_GotFocus() Debug.Print "OLE1_GotFocus()" Debug.Print " OLE1.Value: " & OLE1.Value End Sub But the value is just some

How to restrict the drag and drop area in a canvas

不问归期 提交于 2019-12-10 11:07:08
问题 I have a canvas,lets say of dimensions 500x600.I have some controls inside that canvas.User can rearrange the controls by drag and drop.But I want to restrict the drag and drop within that canvas. For example:There is a button in the canvas.User can drag and drop the button anywhere inside the canvas.But if the user tries to drag the button out of the canvas boundaries,it should stick in the canvas boundary. How to achieve this? 回答1: The signature for startDrag() is public function startDrag

Disable drag and drop when scrolling

白昼怎懂夜的黑 提交于 2019-12-10 10:56:02
问题 I have implemented drag and drop functionality for a TreeView in WPF. All works fine but when the scrolls are shown in the tree view, if I select an item in the tree and then and try to scroll (vertical or horizontal) the TreeView tries to perform a drag drop operation. Here is the source code: class TreeViewRearranger { private TreeView mTreeView; private int MOVE_TOLERANCE = 10; private TreeViewItem mDraggedItem = null; private TreeViewItem mTargetDrop = null; private DropAdorner

How to Drag and Drop from ListWidget onto ComboBox

随声附和 提交于 2019-12-10 10:48:50
问题 The goal is to be able to drag-and-drop ListWidget items onto the comboBox. The dropped items should be added to the combobox. Ideally we want to avoid any tricks with reading listWidget's .currentItem() or .selectedItems() and etc... Ideas? from PyQt4 import QtGui, QtCore import sys, os class MyClass(object): def __init__(self): super(MyClass, self).__init__() self.name=None def setName(self, arg): self.name=arg def getName(self): return self.name class DropableComboBox(QtGui.QComboBox): def

Draggable control in WPF?

别来无恙 提交于 2019-12-10 10:42:29
问题 I'm kind of new to WPF although I have some experience in Forms, and I decided to finally try to figure out how to use WPF. So When I got to draggable controls, this is the code I came up with (I attempted to change it to work with WPF but the control just twitches everywhere): private void rectangle1_MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { double x = this.Left + (double)e.GetPosition(this).X - (double)rectangle1.Margin.Left; double y =