Windows name/path from expression

I like this, but I'm wondering if it would be possible to use this on a label in a header window. For example, I have an application which contains a header screen which is always open, and shows the navigation tab strip, user, date time, etc. Could I somehow get the name from the screen below the header to appear in the header?

The header screen will always be open. Perhaps it is possible to find out which other window is open and to use that window path instead of the parent window path. Please let me know if you have an idea of how that could work. Thank you.

You could just write it out to a client tag and then bind the label in the header to that client tag.

if event.propertyName == ‘componentRunning’ and event.newValue == 1:
     try: 
          pth = system.gui.getParentWindow(event).getComponentForPath(’_parent’).path
          event.source.text = pth
          system.tag.write('[Client]CurWindow',pth)
     except:
          pass

Thanks, I ended up trying this by adding it to the property change script on the label in the header, it works just once though and doesn’t update when I switch screens:

windows = system.gui.getOpenedWindows()

for window in windows:
	pth = window.getPath()
	if pth != 'Header/Navigation':
		system.tag.write('[client]Visualization/WindowLabel',pth)
	else:
		pass

I assume I could put this into a client script which runs in intervals, but that seems to be a bit overkill. I am looking for a solution where I don’t have to add a script to every screen if possible.

EDIT: If I put this into the mouseMotion, mouseMoved event handler on the label, then it updates the label whenever I change screens. Is that a bad idea though, can it be too resource intensive to have it update in that way?

Just put a print statement in to see how often it runs.
If the mouse only goes over it when you are navigating then the resource hit would be negligible.

1 Like

I'm trying this by adding it to the property change script on the label in the navigation, it works just once though, and doesn’t update when I switch screens.

Any idea how to fix this?

Thanks,
Priyanka

I have tried to import this backup but this is an empty backup no template is available in this backup.

https://inductiveautomation.com/exchange/2109/versions

Sometimes you first have to unzip the file and remove the internal zip file from the projects folder:
myInfo_2020-12-03_1818.zip (4.3 KB)
image

1 Like

@justinedwards.jle Thank you good catch!!

1 Like