I own and sell an ActiveX control that allows for custom messages to be displayed on screens, with formatting and embedded data. The control appears on many but not all screens in my system. Some screens have multiple controls monitoring different subsystems (they have different tags driving the message and embedded data).
I have gotten this to work in Ignition by running script (on a button) to one-time set the properties of the control. Now I need to “bind” the message number, embedded data variables, etc to each instance of the control. There doesn’t seem to be a way to bind them literally…true?
If not, can anyone suggest how to do this? I would need to run a “set properties” script to update the control any time any of say 10 or so variables changed (per instance of the contro), and it would only be valid on the client when a screen containing that control was open.
Any help or suggestions on this very much appreciated!
Depending on what your script is doing, you possibly can use bindings. If you want to keep a similar script, you could bind all variables to a property on the screen and use the propertyChange event to fire your script. How are your 10 or so variables brought into ignition? If they are in the database, you could gather them all into a table component and run on the propertyChange event of that table. If they are SQLTags, you could concatenate them all together into a string property and use that for your script trigger.
I am ALMOST there. I put my AX control into a container, added dynamic properties to which I will bind my tags, and used propertyChange event on the container to run a script setting properties on the AX. When the data changes it is doing what I want it to do (or appears to be in a test environment).
One last thing I need to get it to do is initialize when a screen containing this is opened. This does fire the propertyChange event so I have to wait for one of the bound properties to change, which is not going to work. Any hints as to how to tackle that? I guess I need to fire a script or change a property so the script fires when the screen initializes?
You can put your initialization script on the window (instead of the container) under the internalFrameActivated or internalFrameOpened event. This will cause the script to run when the window is opened.
I found that but am unclear on how to access objects in the Root Container from the Window script.
I have multiple controls on some screens. Perhaps if I can add a dynamic “init” property to the Root Container, and have the FrameActivated script set it, I could bind all of the individual controls Init to it.
If you are using the Script Editor tab, on the upper-right of the screen there is a picture of a chain link. You can click on that and select any property and it will paste the path for it into the script editor. From there you can figure out the formula to get the property you want. Accessing a label in the root container should look like:
Also, if you get the window handle, you can use window.getRootContainer() like:
Thanks Robert. I had that too but did not realize it could be persistent, so I was just setting it to 1. Apparently it can still be 1 when I go away and come back (perhaps caching?). So I changed it so it would toggle it, now it appears to do the trick. Thanks again.