Display Current Main Window in Header

Hi,
In other SCADA packages I like to display the title of the current main window in my header bar (which is a separate window). I have been having trouble getting this to work in Ignition. In other packages I would just have an onOpen event on the main window write a value to an internal tag that I could reference. It seems like caching might prevent this approach from working in Ignition.

My first thought was to use the “title” property of the window. However, it appears that is a private property because you can’t bind anything to properties of the window, only to the root container.

So I tried using a client timer script and accessing the name property of the root container of the main window. This still doesn’t work.
windowPath = system.nav.getCurrentWindow()
window = system.gui.getWindow(windowPath)
windowrc = window.getRootContainer()
windowTitle = windowrc.name
system.tag.writeToTag(“Client/MainWindowTitle”, windowTitle)

Thanks for any ideas.

If I remember correctly, the system tag:

[SYSTEM]Client/User/CurrentWindow

Displays the name of the currently open main window. As long as your other windows are docked windows, then it should work. However, the name of the window may be different than the title of the window.

Alternatively, you could insert the following script in the internalFrameActivated event handler for each main window:

system.tag.writeToTag("someClientTagPath", system.gui.getParentWindow(event).title )

Thanks for the reply f_jons!

I tried system/client/user/CurrentWindow first and it just remained blank, no matter what window I was displaying. However, maybe that was a fluke or was because I was previewing the project in “staging” mode rather than in published mode. I notice that that tag does show the correct window name now when I run the project. However, as you may have guessed, I’d like to show a title that will differ from the actual window name (for instance it might include spaces).

I’ll give the InternalFrameActivated event a try. I was worried about having inconsistent behavior on the FrameOpened event due to caching, but maybe activated would work.

No problem! Glad I could help.

The internalFrameActivated event is working well, thanks!