Pablo
Pablo

Reputation: 29519

How to assign value to property of user control?

I have user control with custom properties in my TC3 HMI(TE2000) project. In graphic designer it's easy to assign value to property or bind it to symbol.

However, I can't find how to assign value to custom property from the JS/TS function. Those user controls are already exist in the view. The instance is of type user control host. I've checked that class and no suitable method for assigning values to the custom property. Any workaround without creating new instances of user control from the script?

Upvotes: 0

Views: 495

Answers (1)

warofgod
warofgod

Reputation: 26

TcHmi.Controls.get('Id of the Control').getCustomPropertyName();
TcHmi.Controls.get('Id of the Control').setCustomPropertyName(value);

In the getCustomPropertyName() and setCustomPropertyName(value) methods, the first letter needs to be capitalized; for example: If the property name is customValue => getCustomValue() / setCustomValue(value).

If you do console.log(TcHmi.Controls.get('Id of the Control')), it will show you the list of getter and setter methods you can use.

Upvotes: 1

Related Questions