Pass tag property to window property

I have a tag UDT definition called Motor. This UDT has a custom parameter “Description”. Each time I create an instance of this UDT, I enter the motor description so that I can use it in alarm messages and such.

I also have a popup window, which is the motor control popup (e.g. status, start/stop, etc). This motor window has a custom property “TagPath”, where I specify the path to the tag so that I can call the same popup with multiple instances of the Motor tag.

At the top of the popup I’d like to display the description of the motor. I can create a label, and I’ve got access to the tag path, but I can’t find a way to use that tag path to obtain the value of the specified tag’s “Description” property.

I know I could pass a description string to the window when I open it, but again, I can pass a window property or a tag value, but I can’t find a way to pass a tag property.

Any help is appreciated!

[edit] while I play around, I’m sending a hard-coded string. It’s working, but when I’ve got the label’s text property bound to the Description property, I then can’t use HTML to wrap the text across multiple lines. So, once I have my motor description being passed in correctly, any ideas on how to force the label object to display it with HTML (or at least, across multiple lines)?

Take a look at this post

As for the html, just use an expression bound to the text property of the label like:
"<html>" + {<your string type property>}

I don't bother with closing html tags anymore unless I need to limit the scope

You can also use the html tag or

to otherwise format text after a html tag for text alignment etc. in addition to the wrapping you get from the "conversion" to html, although it sounds like you might already be familiar with this.

1 Like

Thanks, got it working with that thread. I ended up not using the window properties at all, I just ran the following script on window startup:

[code]TagPath = “%s.ExtendedProperties” % system.gui.getParentWindow(event).getComponentForPath(‘Root Container’).TagPath
TagProperties =

if TagProperties.value is not None:
for Property in TagProperties.value:
if Property.getProperty().name == ‘Description’:
system.gui.getParentWindow(event).getComponentForPath(‘Root Container.Motor Description’).text = ‘’+Property.value

A much simpler way is to just create an expression tag in the UDT.
Name it something like MetaDescription and set its expression to ‘{Description}’

We do one for each of our UDT parameters, that makes them available to the UDT and windows.

1 Like

That is nice and simple! I think I’ll do that, it’ll be much easier to see what’s going on for people in the future.