Binding a window name to a property within that window


Question for anyone that may know. How can I bind the name of a window to a component within that window? I can bind the “title” of a window, but not the actual window name. If you are opening and closing windows whether it be by script or event handlers, the window name is wanted, not the “title” and the only way to change the window name that i can figure out is by right clicking it and choosing rename. I may be missing something here, but if any of you know better than I do on this, I would appreciate the help!


You can get a reference to the window to access its name using the system.gui.getParentWindow function. For example to put the name of the window into a label, you would put the following script into the visionWindowOpened event:lblWindowName = system.gui.getParentWindow(event).getComponentForPath('Root Container.lblWindowName') lblWindowName.text = system.gui.getParentWindow(event).name

As far as I can tell the designer doesn’t allow you to dynamically bind that data.

If you want to somehow make use of the window name in a script, it seems you have two options:

  1. Assign the window name to a variable within the root container (using an event script) and then use that in your property bindings.
  2. Find a way to get the calling path of the property that ran the script from within the script itself. (my own attempts at this have failed so far)

For #2:
Here’s what I had in mind when I was attempting to do just that-
It appears that it MIGHT be possible to do this with the “inspect” module, but I’m having problems running that due to an error that appears to be out of my hands for now, so I can’t say for sure.