# mouseDragged on List Component

**URL:** <https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945>\
**Category:** Ignition\
**Tags:** ignition80, scripting, vision\
**Created:** [March 1, 2021, 3:00pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945 "2021-03-01T15:00:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaurav.Shitole](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gaurav.shitole/32/72050_2.png) [@Gaurav.Shitole](https://forum.inductiveautomation.com/u/Gaurav.Shitole)\
**Post date:** [March 1, 2021, 3:00pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/1 "2021-03-01T15:00:18Z")

</div>

Hi guys,

What I am trying to do is, I have a Tag-tree Browser and List Component side by side. When I select a tags in the tag-tree browser and drags them on to list component, it should show tagPaths of those selected tags in List Component upon dropping them.

I tried using **mouseDragged** event handler of list component, but it only works if mouse pressed inside list component and then drag it. However it does not count when I press mouse button outside the list component and then drop onto it.

Please suggest.

Ignition Version: 8.1  
System: Windows 10

---

<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:** [March 1, 2021, 3:28pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/2 "2021-03-01T15:28:30Z")

</div>

The List Component is does not expose an onTagsDropped event handler. This is probably possible to script but is far from trivial.

What is intended to happen once the tag path is in the list component?

To detect the mouse entering a component, you would use the mouseEntered event handler.

---

<div class="post-metadata">

**Author:** ![Gaurav.Shitole](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gaurav.shitole/32/72050_2.png) [@Gaurav.Shitole](https://forum.inductiveautomation.com/u/Gaurav.Shitole)\
**Post date:** [March 1, 2021, 3:49pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/3 "2021-03-01T15:49:43Z")

</div>

Yes earlier I tried that using mouseEntered also. What happens with is is if I select a tag in browser tree and instead of entering into List component I choose not to. Later if I enter into list component area, it adds the last selected tagPath.

The intension is, all the paths collected in list component are saving inside local DB and then some tag historical, history interval , start date, end date comes into picture.

---

<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:** [March 1, 2021, 4:07pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/4 "2021-03-01T16:07:52Z")

</div>

Are you saying that you want to use the table to select tags and then modify the tag’s properties to be historical or not?

---

<div class="post-metadata">

**Author:** ![Gaurav.Shitole](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gaurav.shitole/32/72050_2.png) [@Gaurav.Shitole](https://forum.inductiveautomation.com/u/Gaurav.Shitole)\
**Post date:** [March 1, 2021, 4:12pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/5 "2021-03-01T16:12:35Z")

</div>

No. while selecting tags I will be selecting tags which has historical configured already.

---

<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:** [March 1, 2021, 5:57pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/6 "2021-03-01T17:57:10Z")

</div>

> [@Gaurav.Shitole](#):
>
> The intension is, all the paths collected in list component are saving inside local DB and then some tag historical, history interval , start date, end date comes into picture.

What are you doing with the data? Is this for charting or some other use?

The easy chart will accept dropped tag paths from the tag tree.

---

<div class="post-metadata">

**Author:** ![Gaurav.Shitole](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gaurav.shitole/32/72050_2.png) [@Gaurav.Shitole](https://forum.inductiveautomation.com/u/Gaurav.Shitole)\
**Post date:** [March 2, 2021, 4:19am UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/7 "2021-03-02T04:19:20Z")

</div>

Yeah the charting and some other stuff is there too.

Thing is earlier client were using same layout (tree browser + list component) and upon clicking on tag in Tag Tree, the tagPath would show on right side. So now they want to keep the layout similar but just update it.

Hence after update tagPath should appear in list component after dropping selected tag onto it and not just by selecting tag in tag tree browser.

---

<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:** [March 3, 2021, 8:18pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/8 "2021-03-03T20:18:17Z")

</div>

> [@Gaurav.Shitole](#):
>
> Thing is earlier client were using same layout (tree browser + list component) and upon clicking on tag in Tag Tree, the tagPath would show on right side. So now they want to keep the layout similar but just update it.

There is a fairly significant difference between this and drag and drop. Especially considering that it isn't natively exposed. To properly implement this would require a significant amount of non-trivial java coding.

I can understand not wanting to add a tag to the chart when you click on it. I can also understand how the original programmer arrived at that solution.

I would suggest implementing a popup menu.

For instance I have implemented a popup menu for our ad-hoc charting and give the operators the option of "Loading a Tag" into the chart, or refreshing the tag tree in case tags have been added.

In this way the act of selecting a tag doesn't add it to the chart, instead the operator has to take deliberate action.

---

<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:** [March 5, 2021, 4:59pm UTC](https://forum.inductiveautomation.com/t/mousedragged-on-list-component/43945/9 "2021-03-05T16:59:09Z")

</div>

Okay, so I dug into this and it actually turned out a bit simpler than I thought.

> [@Drag and drop to list component](http://forum.inductiveautomation.com/t/drag-and-drop-to-list-component/44077/16):
>
> Perhaps you were correct? This turned out to be a bit simpler than I was originally thinking. Not trivial, but not really painful either. Add an extension function to your list component, I called mine addDropListener. Then in the script add the following script: from java.awt.dnd import DropTargetAdapter, DropTarget from com.inductiveautomation.ignition.client.tags.dnd import ListOfQualifiedPath class customDragDropListener(DropTargetAdapter): \_comp = None def \_\_init\_\_(self,comp): D…
