Working code: The following expression binding works to dynamically bind a dataset custom property of Component1 to dataset custom properties (“data”) of other components which set Component1.OtherComponentName to their own name when clicked in the runtime.
Code that does not work: Something like the following would be better as it will work regardless of parent window path/name, but it does not work as system.gui.getParentWindow() expects to have an event passed to it and there is no event to pass to it when used in an expression binding like this:
Is there away to get the parent window for this purpose without hardcoding the name (‘folder/window’ in working code above)? Or is there a better way to do this?
Thanks Adam! With “internalFrameActivated” as the filter, the property did not get set (perhaps a timing thing?) but “componentRunning” works. The code below also uses “path” instead of “name” to get folders preceding the window. This code in the root container property change event script works in clients:
if event.propertyName =="componentRunning":
parentWindow = system.gui.getParentWindow(event)
parentWindow.rootContainer.winName = parentWindow.path
However, it does not work in the designer, meaning functionality tied to this (lots in this use case) cannot be tested inside the designer. What would be required to get this script to work in the designer–even if only in preview mode?
That would do it; my mistake. Thanks Adam. This code in the window’s property change script works for clients (EDIT: this code does NOT work - see next post):
if event.propertyName =="internalFrameActivated":
parentWindow = system.gui.getParentWindow(event)
parentWindow.rootContainer.winName = parentWindow.path
Is there a way to get scripts like this to run in the designer–at least in preview mode? Or another way to get this property to set itself in the designer?
Oops, I posted too soon. The value was already set when I published this code, and it remained set… When I restarted the Vision client, the window script code in the previous post did NOT result in setting this value. Here’s a screenshot of what does NOT work:
[attachment=1]Message 2014.05.01 130748.bmp.jpg[/attachment] Options that do work in client: 1 - The previously posted code in root container property change event script:
if event.propertyName =="componentRunning":
parentWindow = system.gui.getParentWindow(event)
parentWindow.rootContainer.winName = parentWindow.path
2 - This script on window:
[attachment=0]Message 2014.05.01 130850.bmp.jpg[/attachment]
Both of these options definitely work in the client. I’m still hoping there’s some way to make this happen in the designer as well. Any suggestions?
Thanks Nick and Adam. The staging client works well where more than a single Vision license is available. In this case, it’s an on machine stand-alone single license HMI that will be duplicated on more stand-alone machines.
Maybe I’ll put in a feature request to include one staging client with each vision license, or–at minimum–to allow staging clients to run with trial mode reset on a system with a limited vision license.
You can always install Ignition locally and run the two hour free trial. Just make a backup of your system and then restore to your local Ignition Gateway. Disable any transaction groups or anything else that may cause double database entries and you should be good.
With that said, I do agree that the Ignition license should include a developer’s license as well.