# Drag and drop from tree view

**URL:** <https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644>\
**Category:** Ignition\
**Created:** [August 21, 2019, 8:14pm UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644 "2019-08-21T20:14:15Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [October 21, 2022, 8:07am UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644/21 "2022-10-21T08:07:56Z")

</div>

any alternative way can we do?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 21, 2022, 8:19am UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644/22 "2022-10-21T08:19:55Z")

</div>

What does this print out?:

```auto
print event.source.getLocation()
print listComponent.getLocation()

```

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [October 21, 2022, 8:22am UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644/23 "2022-10-21T08:22:20Z")

</div>

> [@justinedwards.jle](#):
>
> print event.source.getLocation()  
> print listComponent.getLocation()

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/b/6bfd60867f4e33bfb57c6e5b6177240f08210f24.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 21, 2022, 8:25am UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644/24 "2022-10-21T08:25:44Z")

</div>

Still trying to get my head around what's happening here. Perhaps the is problem is happening because the components are in template containers. Check this and see if we get the expected locations:

```auto
print event.source.parent.getLocation()
print listComponent.parent.getLocation()

```

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [October 21, 2022, 8:29am UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644/25 "2022-10-21T08:29:48Z")

</div>

its working now  
`listComponent = system.gui.getWindow("Data_Superstore/DS_AddMyFav").rootContainer.getComponent('Group 5').getComponent("List")`

replaced above line with

`listComponent = system.gui.getWindow("Data_Superstore/DS_AddMyFav").rootContainer.getComponent('Group 5')`

**calling up to group 5**

its working now

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 21, 2022, 8:31am UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644/26 "2022-10-21T08:31:04Z")

</div>

Excellent. I'm glad this is sorted out

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [October 21, 2022, 8:31am UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644/27 "2022-10-21T08:31:49Z")

</div>

next think i am going to work on multiple drag and drop

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 24, 2022, 8:07pm UTC](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644/28 "2022-10-24T20:07:35Z")

</div>

See this post for a solution which will handle both multi and single selection.

> [@Drag and drop from Tree View to List](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view-to-list/65479/3):
>
> Okay a little bit of work and understanding, and taking @PGriffith's tip, and I was able to accomplish this. This will do multi or single selection, and will handle dragging folders. The drop listener also filters out duplicate paths. You'll want to add this code to a custom function on your Tree View component that you call from the InternalFrameActivated event on the window. def addDragSource(self): from java.awt.dnd import DragSourceAdapter, DragGestureListener, DragSource, DnDConstants …

[Previous page](https://forum.inductiveautomation.com/t/drag-and-drop-from-tree-view/27644.md?page=1)
