windowPath scripting to navigate Windows in Tree View

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)

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.

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

In the properties tool window after selecting the treeview component.

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

1 Like