# Override KeyDown on tree component

**URL:** <https://forum.inductiveautomation.com/t/override-keydown-on-tree-component/89900>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 3, 2024, 3:39pm UTC](https://forum.inductiveautomation.com/t/override-keydown-on-tree-component/89900 "2024-05-03T15:39:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjamin.f.mcneill](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@benjamin.f.mcneill](https://forum.inductiveautomation.com/u/benjamin.f.mcneill)\
**Post date:** [May 3, 2024, 3:39pm UTC](https://forum.inductiveautomation.com/t/override-keydown-on-tree-component/89900/1 "2024-05-03T15:39:56Z")

</div>

Is there a way to trigger an `onClick` event of an element like tree from a button sitting next to the tree?

Ideally I would have a button called `next` which lets user click it and the `onClick` event of the tree would occur on the next item in tree.

I have logic in the button that will actually change the tree selection but it is not triggering the selectionData properties of the tree to update.

Perhaps there is a better way to go about doing this; can't seem to find forum posts on this topic after trying a few times so I figured I would create topic. Will keep hunting and thanks for any ideas / guidance on what to experiment with.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [May 3, 2024, 5:04pm UTC](https://forum.inductiveautomation.com/t/override-keydown-on-tree-component/89900/2 "2024-05-03T17:04:03Z")

</div>

No, you can't simulate clicks or execute onClick Events programatically. You do, however, sound like you have all of the pieces you need to pull the logic out of your onClick Event and put it into a program script, which you CAN then execute from anywhere - you would then just have your onClick Event execute that program script.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 3, 2024, 5:12pm UTC](https://forum.inductiveautomation.com/t/override-keydown-on-tree-component/89900/3 "2024-05-03T17:12:05Z")

</div>

> [@benjamin.f.mcneill](#):
>
> not triggering the selectionData properties of the tree to update

I think this is the crux of the problem. No way to do that from a script.

---

<div class="post-metadata">

**Author:** ![benjamin.f.mcneill](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@benjamin.f.mcneill](https://forum.inductiveautomation.com/u/benjamin.f.mcneill)\
**Post date:** [May 3, 2024, 5:29pm UTC](https://forum.inductiveautomation.com/t/override-keydown-on-tree-component/89900/4 "2024-05-03T17:29:50Z")

</div>

Ok thanks for the info; it helps me course correct.
