# windowPath scripting to navigate Windows in Tree View

**URL:** <https://forum.inductiveautomation.com/t/windowpath-scripting-to-navigate-windows-in-tree-view/29685>\
**Category:** Ignition\
**Created:** [November 5, 2019, 2:15pm UTC](https://forum.inductiveautomation.com/t/windowpath-scripting-to-navigate-windows-in-tree-view/29685 "2019-11-05T14:15:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CCoker1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ccoker1/32/22605_2.png) [@CCoker1](https://forum.inductiveautomation.com/u/CCoker1)\
**Post date:** [November 5, 2019, 2:15pm UTC](https://forum.inductiveautomation.com/t/windowpath-scripting-to-navigate-windows-in-tree-view/29685/1 "2019-11-05T14:15:49Z")

</div>

Hello, I’ve used Ignition in the past and have recently picked it back up so I’m rusty. I’m trying to mouse click selections in the Tree View Navigation to navigate from screen to screen. I used the following given code from Inductive Automation but I get an error for not defining “data”. Where would I define “data”:

# If the user performs a double-click, open the appropriate window

if event.clickCount == 2:  
row = event.source.data  
if row != -1:  
# Grab the window path value out of the tree view’s items dataset  
windowPath = data.getValueAt(row, “windowPath”)  
system.nav.swapTo(windowPath)

---

<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:** [November 5, 2019, 2:59pm UTC](https://forum.inductiveautomation.com/t/windowpath-scripting-to-navigate-windows-in-tree-view/29685/2 "2019-11-05T14:59:00Z")

</div>

That code presumes it is an event on the treeview object itself, which has a data property. If you put that code elsewhere, you’ll have to obtain a reference to the treeview component and get its properties on that reference.

---

<div class="post-metadata">

**Author:** ![CCoker1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ccoker1/32/22605_2.png) [@CCoker1](https://forum.inductiveautomation.com/u/CCoker1)\
**Post date:** [November 5, 2019, 3:57pm UTC](https://forum.inductiveautomation.com/t/windowpath-scripting-to-navigate-windows-in-tree-view/29685/3 "2019-11-05T15:57:56Z")

</div>

Thanks for the help! Would that data property name be under the Project Browser after I select the Treeview Component?

---

<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:** [November 5, 2019, 4:22pm UTC](https://forum.inductiveautomation.com/t/windowpath-scripting-to-navigate-windows-in-tree-view/29685/4 "2019-11-05T16:22:24Z")

</div>

In the properties tool window after selecting the treeview component.

---

<div class="post-metadata">

**Author:** ![CCoker1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ccoker1/32/22605_2.png) [@CCoker1](https://forum.inductiveautomation.com/u/CCoker1)\
**Post date:** [November 5, 2019, 4:31pm UTC](https://forum.inductiveautomation.com/t/windowpath-scripting-to-navigate-windows-in-tree-view/29685/5 "2019-11-05T16:31:24Z")

</div>

Thanks for your help pturmel! I restructured the code and now it’s navigating appropriately.
